[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: [libvirt] [PATCH] Add a rule for generating .hgignore



On Thu, Jan 22, 2009 at 08:31:46AM +0100, Jim Meyering wrote:
> john levon sun com wrote:
> > Add a rule for generating .hgignore
> >
> > diff --git a/Makefile.maint b/Makefile.maint
> > --- a/Makefile.maint
> > +++ b/Makefile.maint
> > @@ -717,3 +717,5 @@ sync-vcs-ignore-files:
> >  	mv $(c2g)-t $(c2g)
> >  	perl $(c2g)
> >  	rm -f $(c2g)
> > +	find $(srcdir) -name .gitignore | xargs cat \
> > +	    | sort -u | sed 's+\*+.*+' >.hgignore
> 
> There are a couple of problems when doing it that way:
> 
>   .gitignore uses glob syntax, while .hgignore uses regexps by default.
>     You can use the "syntax: glob" directive to tell hg what to do.
> 
>   hoisting subdir-specific ignore directives all into a top-level
>     .hgignore file is risky.  What if a generated (hence ignored) file
>     in a subdirectory is also the name of something that must not be
>     ignored at some other point in the tree?

I'd expect to just prepend the directory path for the rules from subdirs
Perhaps with

    echo "syntax: glob" > .hgignore
    for ignore in `find $(srcdir) -name .gitignore
    do
       dir=`dirname $ignore`
       for rule in `cat $ignore` 
       do
          echo "$dir/$rule" >> .hgignore
       done
    done

Daniel
-- 
|: Red Hat, Engineering, London   -o-   http://people.redhat.com/berrange/ :|
|: http://libvirt.org  -o-  http://virt-manager.org  -o-  http://ovirt.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505  -o-  F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]