[PATCH 1 of 3 STABLE] mq: add ".hgsubstate" to patch target list only if it is not listed up yet

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Fri Jun 22 02:53:09 CDT 2012


At Thu, 21 Jun 2012 11:31:13 -0500,
Kevin Bullock wrote:
> 
> [1  <text/plain; utf-8 (quoted-printable)>]
> On Jun 21, 2012, at 5:55 AM, FUJIWARA Katsunori wrote:
> 
> > # HG changeset patch
> > # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> > # Date 1340275722 -32400
> > # Branch stable
> > # Node ID 658e4c908b3782f44bf4c3b541abfbd0b86e9acc
> > # Parent  01eb882489371c2f2f4de3500497cade12df2883
> > mq: add ".hgsubstate" to patch target list only if it is not listed up yet
> > 
> > if ".hgsubstate" is already listed up as one of commit targets, qnew
> > put diff of ".hgsubstate" twice into the patch file stored under
> > ".hg/patches".
> 
> Oh, good catch! (but see below)
> 
> > it causes rejections at applying such patches.
> > 
> > other than the case like in added test script, this can also occur
> > when qnew is executed just after rolling back the committing updated
> > ".hgsubstate".
> > 
> > this patch checks whether ".hgsubstate" is already listed up as one of
> > commit targets, and put it into the appropriate list only if it is not
> > listed up yet.
> > 
> > diff -r 01eb88248937 -r 658e4c908b37 hgext/mq.py
> > --- a/hgext/mq.py	Mon Jun 18 20:07:25 2012 +0200
> > +++ b/hgext/mq.py	Thu Jun 21 19:48:42 2012 +0900
> > @@ -924,6 +924,18 @@
> >                 inclsubs.append(s)
> >         return inclsubs
> > 
> > +    def putsubstate2changes(self, substatestate, changes):
> > +        for files in changes[:3]:
> > +            if '.hgsubstate' in files:
> > +                return # already listed up
> > +        # not yet listed up
> > +        if substatestate in 'a?':
> > +            changes[1].append('.hgsubstate')
> > +        elif substatestate in 'r':
> > +            changes[2].append('.hgsubstate')
> > +        else: # modified
> > +            changes[0].append('.hgsubstate')
> > +
> 
> …but why does this require a new function that only gets called once?

Sorry not enough explanation.

"putsubstate2changes()" is used also next patch in this series: create
patch file after commit to import diff of ".hgsubstate" at qrefresh.

----------------------------------------------------------------------
[FUJIWARA Katsunori]                             foozy at lares.dti.ne.jp


More information about the Mercurial-devel mailing list