D7998: merge: replace a repo.lookup('.') by more typical repo['.'].node()

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Sat Jan 25 00:18:37 UTC 2020


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  The `repo.lookup('.')` form comes from b3311e26f94f <https://phab.mercurial-scm.org/rHGb3311e26f94f69eeb0e7df4fc3d7b743f3d86969> (merge: fix
  --preview to show all nodes that will be merged (issue2043).,
  2010-02-15). I don't know why that commit changed from `repo['.']`,
  but I don't think there's any reason to do that. Note that performance
  should not be a reason (anymore?), because repo.lookup() is
  implemented by first creating a context object.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D7998

AFFECTED FILES
  mercurial/commands.py

CHANGE DETAILS

diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -4878,7 +4878,7 @@
 
     if opts.get(b'preview'):
         # find nodes that are ancestors of p2 but not of p1
-        p1 = repo.lookup(b'.')
+        p1 = repo[b'.'].node()
         p2 = node
         nodes = repo.changelog.findmissing(common=[p1], heads=[p2])
 



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list