Hello Daniel, well, I dunno. My feeling is that firering a perl process each time we press on tab is somehow wrong. But I now realize that quilt already depends on perl on several locations. That looks wrong to me but if the others don't mind, I guess that your patch can get in as it is.
Thanks for your time, Mt On Sun, Jan 20, 2013 at 01:15:47AM +0100, Daniel Lovasko wrote: > Hi Martin! > > The only reason for choosing perl over sed, was perl's regex ability \Q \E, > which stops regex engine from interpreting > text between them (something like literal mode) - resulting into fact, that > variable $QUILT_PATCHES can be freely pasted > into the regex. So that there is no worry having special meta-characters > inside the variable. > > While I do not see your point (but I still respect it), I can offer this > sed-only solution: > before passing the $QUILT_PATCHES, make a copy of it, and in that copy, > substitute all special meta-chars that sed > recognizes with their literal alternative. For example changing "." into "\.". > > What do you think? Should I implement this? > Thanks for your feedback and have a nice day, > > Daniel > > >>> Martin Quinson <martin.quin...@loria.fr> 01/19/13 11:00 AM >>> > Hello Daniel, thanks for your work. > > On Thu, Jan 17, 2013 at 02:50:08PM +0100, Daniel Lovasko wrote: > > Hi all, > > > > in the attached patch is my solution for this bug. > > Could you please comment a bit on how different this solution is wrt > the patch gentoo278641b.patch provided by the bug reporter? From what > I can see, you went for perl instead of sed and adapted to the fact > that errors are redirected to /dev/null. > > I'd say that relying on perl is wrong. If we mandate perl anywhere in > quilt, we should rather reimplement anything in perl. Could you please > change it back to sed? > > Thanks again, Mt. > > PS: I was wondering whether it is possible to write some sort of test > files for this, but I guess it's simply impossible. > > > diff --git a/bash_completion b/bash_completion > > index 19736cb..1241d15 100644 > > --- a/bash_completion > > +++ b/bash_completion > > @@ -86,6 +86,21 @@ _quilt_comfile() > > done > > } > > > > +# Resolve paths to patches only inside QUILT_PATCHES directory > > +# > > +# Problem with `quilt series` within completion is it's nature of output > > +# as it produces relative path to current working directory, instead of > > +# relative path to QUILT_PATCHES directory. > > +# > > +# sed explanation: capture as many as possible of "../" and after that > > +# QUILT_PATCHES directory name (if not defined, use default "patches") > > +# and remove it all from each filename > > +# > > +_quilt_patchlist() > > +{ > > + quilt $1 | perl -pne 's:^(\.\./)*\Q'"${QUILT_PATCHES:-patches}"'\E/?::' > > +} > > + > > _quilt_completion() > > { > > local cur prev cmds command_matches > > @@ -123,7 +138,7 @@ _quilt_completion() > > add) > > case $prev in > > -P) > > - COMPREPLY=( $( compgen -W "$(quilt applied 2>/dev/null)" -- > > $cur ) ) > > + COMPREPLY=( $( compgen -W "$(_quilt_patchlist applied > > 2>/dev/null)" -- $cur ) ) > > ;; > > *) > > _quilt_comfile > > @@ -134,7 +149,7 @@ _quilt_completion() > > annotate) > > case $prev in > > -P) > > - COMPREPLY=( $( compgen -W "$(quilt applied 2>/dev/null)" -- > > $cur ) ) > > + COMPREPLY=( $( compgen -W "$(_quilt_patchlist applied > > 2>/dev/null)" -- $cur ) ) > > ;; > > *) > > _quilt_comfile > > @@ -143,10 +158,10 @@ _quilt_completion() > > esac > > ;; > > applied) > > - COMPREPLY=( $( compgen -W "-h $(quilt applied 2>/dev/null)" -- $cur > > ) ) > > + COMPREPLY=( $( compgen -W "-h $(_quilt_patchlist applied > > 2>/dev/null)" -- $cur ) ) > > ;; > > delete) > > - COMPREPLY=( $( compgen -W "-n -r -h --backup $(quilt series)" -- > > $cur ) ) > > + COMPREPLY=( $( compgen -W "-n -r -h --backup $(_quilt_patchlist > > series)" -- $cur ) ) > > ;; > > diff) > > case $prev in > > @@ -154,7 +169,7 @@ _quilt_completion() > > COMPREPLY=( $( compgen -W "0 1" -- $cur ) ) > > ;; > > -P|--combine) > > - COMPREPLY=( $( compgen -W "$(quilt applied 2>/dev/null)" -- > > $cur ) ) > > + COMPREPLY=( $( compgen -W "$(_quilt_patchlist applied > > 2>/dev/null)" -- $cur ) ) > > ;; > > --diff|-U|-C) > > ;; > > @@ -1 > 71,10 +186,10 @@ _quilt_completio> - COMPREPLY=( $( compgen -W > "$(quilt applied 2>/dev/null)" -- $cur ) ) > > + COMPREPLY=( $( compgen -W "$(_quilt_patchlist applied > > 2>/dev/null)" -- $cur ) ) > > ;; > > *) > > - COMPREPLY=( $( compgen -W "-a -l -v -h --combine $(quilt applied > > 2>/dev/null)" -- $cur ) ) > > + COMPREPLY=( $( compgen -W "-a -l -v -h --combine > > $(_quilt_patchlist applied 2>/dev/null)" -- $cur ) ) > > ;; > > esac > > ;; > > @@ -198,7 +213,7 @@ _quilt_completion() > > COMPREPLY=( $( compgen -W "files" -- $cur ) ) > > ;; > > *) > > - COMPREPLY=( $( compgen -W "-T -h --all --reduce --lines > > --edge-labels $(quilt applied 2>/dev/null)" -- $cur ) > ) > > + COMPREPLY=( $( compgen -W "-T -h --all --reduce --lines > > --edge-labels $(_quilt_patchlist applied > 2>/dev/null)" -- $cur ) ) > > ;; > > esac > > ;; > > @@ -207,7 +222,7 @@ _quilt_completion() > > COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "-h" -- $cur ) ) > > ;; > > header) > > - COMPREPLY=( $( compgen -W "-a -e -h -r --backup --strip-diffstat > > --strip-trailing-whitespace $(quilt series)" > -- $cur ) ) > > + COMPREPLY=( $( compgen -W "-a -e -h -r --backup --strip-diffstat > > --strip-trailing-whitespace > $(_quilt_patchlist series)" -- $cur ) ) > > ;; > > import) > > case $prev in > > @@ -229,17 +244,17 @@ _quilt_completion() > > COMPREPLY=( $( compgen -W "-m --prefix --mbox --send --sender > > --from --subject --to --cc --bcc" -- $cur ) ) > > ;; > > next|previous) > > - COMPREPLY=( $( compgen -W "$(quilt series)" -- $cur ) ) > > + COMPREPLY=( $( compgen -W "$(_quilt_patchlist series)" -- $cur ) ) > > ;; > > patches) > > _quilt_comfile > > COMPREPLY=( ${COMPREPLY[@]:-} $( compgen -W "-v -h" -- $cur ) ) > > ;; > > pop) > > - COMPREPLY=( $( compgen -W "-a -f -R -q -v -h $(quilt applied > > 2>/dev/null)" -- $cur ) ) > > + COMPREPLY=( $( compgen -W "-a -f -R -q -v -h $(_quilt_patchlist > > applied 2>/dev/null)" -- $cur ) ) > > ;; > > push) > > - COMPREPLY=( $( compgen -W "-a -f -q -v -h --leave-rejects > > --interactive --color $(quilt unapplied > 2>/dev/null)" -- $cur ) ) > > + COMPREPLY=( $( compgen -W "-a -f -q -v -h --leave-rejects > > --interactive --color $(_quilt_patchlist unapplied > 2>/dev/null)" -- $cur ) ) > > ;; > > refresh) > > case $prev in > > @@ -249,14 +264,14 @@ _quilt_completion() > > -U|-C) > > ;; > > *) > > - COMPREPLY=( $( compgen -W "-p -u -U -c -C -f -h $(quilt > > applied 2>/dev/null) --no-timestamps --no-index > --diffstat --sort --backup --strip-trailing-whitespace" -- $cur ) ) > > + COMPREPLY=( $( compgen -W "-p -u -U -c -C -f -h > > $(_quilt_patchlist applied 2>/dev/null) --no-timestamps > --no-index --diffstat --sort --backup --strip-trailing-whitespace" -- $cur ) ) > > ;; > > esac > > ;; > > remove|revert) > > case $prev in > > -P) > > - COMPREPLY=( $( compgen -W "$(quilt applied 2>/dev/null)" -- > > $cur ) ) > > + COMPREPLY=( $( compgen -W "$(_quilt_patchlist applied > > 2>/dev/null)" -- $cur ) ) > > ;; > > *) > > _quilt_comfile > > @@ -267,7 +282,7 @@ _quilt_completion() > > rename) > > case $prev in > > -P) > > - COMPREPLY=( $( compgen -W "$(quilt series)" -- $cur ) ) > > + COMPREPLY=( $( compgen -W "$(_quilt_patchlist series)" -- $cur ) ) > > ;; > > *) > > COMPREPLY=( $( compgen -W "-P -h" -- $cur ) ) > > @@ -292,7 +307,7 @@ _quilt_completion() > > COMPREPLY=( $( compgen -W "-d -h" -- $cur ) ) > > ;; > > unapplied) > > - COMPREPLY=( $( compgen -W "-h $(quilt series)" -- $cur ) ) > > + COMPREPLY=( $( compgen -W "-h $(_quilt_patchlist series)" -- $cur ) > > ) > > ;; > > fork|new|top|upgrade) > > ;; _______________________________________________ Quilt-dev mailing list Quilt-dev@nongnu.org https://lists.nongnu.org/mailman/listinfo/quilt-dev