[PATCH] qrefresh += --amend (#933)

Kirill Smelkov kirr at landau.phys.spbu.ru
Fri Jan 18 17:14:34 CST 2008


On Fri, Jan 18, 2008 at 08:38:45PM -0200, Alexis S. L. Carvalho wrote:
> Thus spake Kirill Smelkov:
> > # HG changeset patch
> > # User Kirill Smelkov <kirr at mns.spb.ru>
> > # Date 1200685207 -10800
> > # Node ID 48fa1430786a31d4e31d80832c4d9215268e25e4
> > # Parent  fb93c774dffff3601835102fdb57417428307cba
> > qrefresh += --amend  (#933)
> > 
> > It would be handy to say 'hg qrefresh file.txt' to add changes made to file.txt
> > to current patch.
> > 
> > Unfortunately this is not qrefresh behaviour -- it just excludes everything but
> > file.txt from refreshed patch. We discussed this on irc, and it seems people
> > are against changing this behaviour becuase of backward compatibility.
> > 
> > So here it comes 'hg qrefresh --amend ...' for folks like me who wants just to
> > incrementally refresh their patches.
> 
> On IRC I understood something different from what your patch does (and I
> still do when I read this description...).
>  
> I thought you wanted something like "keep the patch exactly as is (even
> if some file touched by the patch was modified again in the working dir)
> and add the changes to file.txt".
>  
> But your patch does something like "the patch is updated, but contains 
> only the files that were already in the patch and file.txt".
> 
> This is very close to what "qrefresh --short" does.  And since it 
> ignores any files passed on the command line, how about just extending 
> it instead of adding a new option?

You are 100% right -- I overlooked it in a hurry, sorry!
It seems I need to sleep more :(

> > diff --git a/tests/test-mq-qrefresh b/tests/test-mq-qrefresh
> > --- a/tests/test-mq-qrefresh
> > +++ b/tests/test-mq-qrefresh
> > @@ -82,3 +82,17 @@
> >  cat .hg/patches/mqbase | \
> >  sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
> >      -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
> > +
> > +echo % qrefresh --amend
> > +hg qrefresh 1/base
> > +hg qrefresh --amend 2/base
> 
> You'll want to change some other file before the qrefreshes, to test 
> that it won't be included in the patch.
> 
> > +
> > +echo % qdiff
> > +hg qdiff | sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
> > +               -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
> > +
> > +echo % patch file contents
> > +cat .hg/patches/mqbase | \
> > +sed -e "s/\(+++ [a-zA-Z0-9_/.-]*\).*/\1/" \
> > +    -e "s/\(--- [a-zA-Z0-9_/.-]*\).*/\1/"
> 
> And you'll want a "hg diff" somewhere to make sure this other file 
> wasn't committed.

Will try to do it the right way,
Thanks for spotting my mistakes.

-- 
    Всего хорошего, Кирилл.
    http://landau.phys.spbu.ru/~kirr/aiv/


More information about the Mercurial-devel mailing list