[PATCH 4 of 6 STABLE V3] merge: check filename case collision between merged changesets

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Wed Dec 14 00:36:59 CST 2011


At Tue, 13 Dec 2011 14:07:16 -0600,
Matt Mackall wrote:
> 
> On Mon, 2011-12-12 at 22:25 +0900, FUJIWARA Katsunori wrote:
> > # HG changeset patch
> > # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> > # Date 1323677419 -32400
> > # Branch stable
> > # Node ID 34aba3511c68823a927bf5957f813ae0d3dd4214
> > # Parent  d7229f60ad8aacd657d780935235a84048413dc6
> > merge: check filename case collision between merged changesets
> > 
> > this patch makes merge abort when merged changesets have same file in
> > different case on case insensitive filesystem.
> > 
> > diff -r d7229f60ad8a -r 34aba3511c68 mercurial/merge.py
> > --- a/mercurial/merge.py	Mon Dec 12 17:10:19 2011 +0900
> > +++ b/mercurial/merge.py	Mon Dec 12 17:10:19 2011 +0900
> > @@ -96,7 +96,7 @@
> >              raise util.Abort(_("untracked file in working directory differs"
> >                                 " from file in requested revision: '%s'") % fn)
> >  
> > -def _checkcollision(mctx):
> > +def _checkcollision(mctx, wctx):
> >      "check for case folding collisions in the destination context"
> >      folded = {}
> >      for fn in mctx:
> > @@ -106,6 +106,13 @@
> >                               % (fn, folded[fold]))
> >          folded[fold] = fn
> > +    for fn in (wctx or []):
> 
> "if wctx:", please
> 
> > +            _checkcollision(p2, branchmerge and p1)
> 
> What happens on linear updates? Is it correct?
> 
> If Alice moves 'a' to 'A' and then Bob pulls and updates while he has
> edits to 'a', will he now have a modified 'A'?

Oops, sorry, I overlooked such case. 

At first, I simply thought that 'branchmerge' of merge.update() is
false for ordinary linear updating.

And now, I confirmed that my patch does not prevent merging in linear
update, which you described: branchmerge seems to be False for any
linear updates, even though merging with working context is needed.

So, I'll post with enhancement of new test to check also merging in
linear update.

# of course, with "if wctx:" fix, too

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


More information about the Mercurial-devel mailing list