Mercurial > public > mercurial-scm > hg-stable
diff mercurial/localrepo.py @ 23929:a43fdf33a6be stable
commit: remove reverse search for copy source when not in parent (issue4476)
Previously, we had weird, nonsensical behavior when committing a file move
with a missing source. This removes that weird logic and tests that the bug
this strange behavior caused is fixed. Also adds a longish comment to prevent
some poor soul from accidentally re-implementing the bug in the future.
author | Ryan McElroy <rmcelroy@fb.com> |
---|---|
date | Tue, 20 Jan 2015 15:05:44 -0800 |
parents | 3cbb5bf4035d |
children | ed5e8a9598ce |
line wrap: on
line diff
--- a/mercurial/localrepo.py Tue Jan 20 14:51:11 2015 -0800 +++ b/mercurial/localrepo.py Tue Jan 20 15:05:44 2015 -0800 @@ -1206,14 +1206,14 @@ crev = manifest2[cfname] newfparent = fparent1 - # find source in nearest ancestor if we've lost track - if not crev: - self.ui.debug(" %s: searching for copy revision for %s\n" % - (fname, cfname)) - for ancestor in self[None].ancestors(): - if cfname in ancestor: - crev = ancestor[cfname].filenode() - break + # Here, we used to search backwards through history to try to find + # where the file copy came from if the source of a copy was not in + # the parent diretory. However, this doesn't actually make sense to + # do (what does a copy from something not in your working copy even + # mean?) and it causes bugs (eg, issue4476). Instead, we will warn + # the user that copy information was dropped, so if they didn't + # expect this outcome it can be fixed, but this is the correct + # behavior in this circumstance. if crev: self.ui.debug(" %s: copy %s:%s\n" % (fname, cfname, hex(crev)))