# HG changeset patch # User Matt Mackall # Date 1289862295 21600 # Node ID 417f3c27983bcb6ab95b169801edc63c5c138dcf # Parent acd69df118ab1e81cb5e3fa90cd2b33f2f7aabe4 commit: search both parents for missing copy revision (issue2484) raise a proper abort if we can't find an ancestor diff -r acd69df118ab -r 417f3c27983b mercurial/localrepo.py --- a/mercurial/localrepo.py Mon Nov 15 17:00:43 2010 -0600 +++ b/mercurial/localrepo.py Mon Nov 15 17:04:55 2010 -0600 @@ -819,15 +819,20 @@ if not crev: self.ui.debug(" %s: searching for copy revision for %s\n" % (fname, cfname)) - for ancestor in self['.'].ancestors(): + for ancestor in self[None].ancestors(): if cfname in ancestor: crev = ancestor[cfname].filenode() break - self.ui.debug(" %s: copy %s:%s\n" % (fname, cfname, hex(crev))) - meta["copy"] = cfname - meta["copyrev"] = hex(crev) - fparent1, fparent2 = nullid, newfparent + if crev: + self.ui.debug(" %s: copy %s:%s\n" % (fname, cfname, hex(crev))) + meta["copy"] = cfname + meta["copyrev"] = hex(crev) + fparent1, fparent2 = nullid, newfparent + else: + self.ui.warn(_("warning: can't find ancestor for '%s' " + "copied from '%s'!\n") % (fname, cfname)) + elif fparent2 != nullid: # is one parent an ancestor of the other? fparentancestor = flog.ancestor(fparent1, fparent2)