D4781: repo: don't look up context for tip node if it's not needed

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Fri Sep 28 08:03:06 EDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG1834dabb38e0: repo: don't look up context for tip node if it's not needed (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4781?vs=11453&id=11466

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

AFFECTED FILES
  contrib/python-hook-examples.py
  hgext/mq.py
  tests/test-commit.t

CHANGE DETAILS

diff --git a/tests/test-commit.t b/tests/test-commit.t
--- a/tests/test-commit.t
+++ b/tests/test-commit.t
@@ -650,7 +650,7 @@
   > def filectxfn(repo, memctx, path):
   >     return context.memfilectx(repo, memctx, path,
   >         b'[hooks]\nupdate = echo owned')
-  > c = context.memctx(r, [r[b'tip'].node(), node.nullid],
+  > c = context.memctx(r, [r.changelog.tip(), node.nullid],
   >                    b'evil', [notrc], filectxfn, 0)
   > r.commitctx(c)
   > EOF
diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -980,10 +980,10 @@
                 files += mergedsubstate.keys()
 
             match = scmutil.matchfiles(repo, files or [])
-            oldtip = repo['tip']
+            oldtip = repo.changelog.tip()
             n = newcommit(repo, None, message, ph.user, ph.date, match=match,
                           force=True)
-            if repo['tip'] == oldtip:
+            if repo.changelog.tip() == oldtip:
                 raise error.Abort(_("qpush exactly duplicates child changeset"))
             if n is None:
                 raise error.Abort(_("repository commit failed"))
diff --git a/contrib/python-hook-examples.py b/contrib/python-hook-examples.py
--- a/contrib/python-hook-examples.py
+++ b/contrib/python-hook-examples.py
@@ -19,7 +19,7 @@
     node = kwargs['node']
     first = repo[node].p1().node()
     if 'url' in kwargs:
-        last = repo['tip'].node()
+        last = repo.changelog.tip()
     else:
         last = node
     diff = patch.diff(repo, first, last)



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


More information about the Mercurial-devel mailing list