Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 13000:417f3c27983b stable
commit: search both parents for missing copy revision (issue2484)
raise a proper abort if we can't find an ancestor
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 15 Nov 2010 17:04:55 -0600 |
parents | fabe61418a53 |
children | cc4e13c92dfa c1492615cdee |
comparison
equal
deleted
inserted
replaced
12999:acd69df118ab | 13000:417f3c27983b |
---|---|
817 | 817 |
818 # find source in nearest ancestor if we've lost track | 818 # find source in nearest ancestor if we've lost track |
819 if not crev: | 819 if not crev: |
820 self.ui.debug(" %s: searching for copy revision for %s\n" % | 820 self.ui.debug(" %s: searching for copy revision for %s\n" % |
821 (fname, cfname)) | 821 (fname, cfname)) |
822 for ancestor in self['.'].ancestors(): | 822 for ancestor in self[None].ancestors(): |
823 if cfname in ancestor: | 823 if cfname in ancestor: |
824 crev = ancestor[cfname].filenode() | 824 crev = ancestor[cfname].filenode() |
825 break | 825 break |
826 | 826 |
827 self.ui.debug(" %s: copy %s:%s\n" % (fname, cfname, hex(crev))) | 827 if crev: |
828 meta["copy"] = cfname | 828 self.ui.debug(" %s: copy %s:%s\n" % (fname, cfname, hex(crev))) |
829 meta["copyrev"] = hex(crev) | 829 meta["copy"] = cfname |
830 fparent1, fparent2 = nullid, newfparent | 830 meta["copyrev"] = hex(crev) |
831 fparent1, fparent2 = nullid, newfparent | |
832 else: | |
833 self.ui.warn(_("warning: can't find ancestor for '%s' " | |
834 "copied from '%s'!\n") % (fname, cfname)) | |
835 | |
831 elif fparent2 != nullid: | 836 elif fparent2 != nullid: |
832 # is one parent an ancestor of the other? | 837 # is one parent an ancestor of the other? |
833 fparentancestor = flog.ancestor(fparent1, fparent2) | 838 fparentancestor = flog.ancestor(fparent1, fparent2) |
834 if fparentancestor == fparent1: | 839 if fparentancestor == fparent1: |
835 fparent1, fparent2 = fparent2, nullid | 840 fparent1, fparent2 = fparent2, nullid |