Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/localrepo.py @ 20556:db0740a487ab
localrepo: commit: avoid calling expensive ancestor function when p1 is nullrev
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Mon, 24 Feb 2014 22:42:14 +0100 |
parents | 6b4c789d618d |
children | de8eb208b7d0 |
comparison
equal
deleted
inserted
replaced
20555:4add43865a9b | 20556:db0740a487ab |
---|---|
1121 fparent1, fparent2 = nullid, newfparent | 1121 fparent1, fparent2 = nullid, newfparent |
1122 else: | 1122 else: |
1123 self.ui.warn(_("warning: can't find ancestor for '%s' " | 1123 self.ui.warn(_("warning: can't find ancestor for '%s' " |
1124 "copied from '%s'!\n") % (fname, cfname)) | 1124 "copied from '%s'!\n") % (fname, cfname)) |
1125 | 1125 |
1126 elif fparent1 == nullid: | |
1127 fparent1, fparent2 = fparent2, nullid | |
1126 elif fparent2 != nullid: | 1128 elif fparent2 != nullid: |
1127 # is one parent an ancestor of the other? | 1129 # is one parent an ancestor of the other? |
1128 fparentancestor = flog.ancestor(fparent1, fparent2) | 1130 fparentancestor = flog.ancestor(fparent1, fparent2) |
1129 if fparentancestor == fparent1: | 1131 if fparentancestor == fparent1: |
1130 fparent1, fparent2 = fparent2, nullid | 1132 fparent1, fparent2 = fparent2, nullid |