Problem with merge after a dir rename

Matt Mackall mpm at selenic.com
Thu Jan 14 12:01:24 CST 2016


On Thu, 2016-01-14 at 12:25 -0500, Long Vu wrote:
> On Thu, Jan 14, 2016 at 10:59 AM, Long Vu <long.vu at intelerad.com> wrote:
> > On Wed, Jan 13, 2016 at 10:34 AM, Matt Mackall <mpm at selenic.com> wrote:
> > > On Tue, 2016-01-12 at 15:28 -0500, Long Vu wrote:
> > > > Test2.java should have been under java-project/test/com/package/, not
> > > > "source".
> > > 
> > > So the theory is that we should only infer a directory move when ALL the
> > > files
> > > in a given directory are moved. But apparently there's a bug here. The
> > > non-
> > > determinism is caused by randomization of Python's hashing constant. Give
> > > this
> > > patch a try if you can:
> > > 
> > > diff -r 81bca91a0507 mercurial/copies.py
> > > --- a/mercurial/copies.py       Tue Jan 12 15:08:03 2016 -0600
> > > +++ b/mercurial/copies.py       Wed Jan 13 09:32:20 2016 -0600
> > > @@ -401,13 +401,13 @@
> > >              continue
> > >          elif dsrc in d1 and ddst in d1:
> > >              # directory wasn't entirely moved locally
> > > -            invalid.add(dsrc)
> > > +            invalid.add(dsrc + "/")
> > >          elif dsrc in d2 and ddst in d2:
> > >              # directory wasn't entirely moved remotely
> > > -            invalid.add(dsrc)
> > > -        elif dsrc in dirmove and dirmove[dsrc] != ddst:
> > > +            invalid.add(dsrc + "/")
> > > +        elif dsrc + "/" in dirmove and dirmove[dsrc + "/"] != ddst + "/":
> > >              # files from the same directory moved to two different places
> > > -            invalid.add(dsrc)
> > > +            invalid.add(dsrc + "/")
> > >          else:
> > >              # looks good so far
> > >              dirmove[dsrc + "/"] = ddst + "/"
> > > 
> > 
> > Will try the proposed patch, thanks.
> > 
> 
> Patch works (on tip of stable bf86e3e87123), added files are not
> automatically randomly moved to one of source/ or test/ but created in
> their original location (which is the expected behaviour).
> 
> However, the added files show up as modified instead of added in hg
> status, but then correctly show up as added after commit is done.  I
> think I've seen this behaviour before.  Is this also a known issue?

That is expected. They're not added relative to p2. Diff (1974) and status
(2005) have very different views of the world.

-- 
Mathematics is the supreme nostalgia of our time.



More information about the Mercurial mailing list