changeset 41420:2ff8994ac71d

cleanup: use repo['.'] instead of repo[None].p1() Differential Revision: https://phab.mercurial-scm.org/D5707
author Martin von Zweigbergk <martinvonz@google.com>
date Fri, 25 Jan 2019 23:43:11 -0800
parents 0bd56c291359
children 5cb8158a61f7
files contrib/synthrepo.py hgext/fastannotate/formatter.py mercurial/commands.py
diffstat 3 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/synthrepo.py	Fri Jan 25 23:36:23 2019 -0800
+++ b/contrib/synthrepo.py	Fri Jan 25 23:43:11 2019 -0800
@@ -349,7 +349,7 @@
     # to the modeled directory structure.
     initcount = int(opts['initfiles'])
     if initcount and initdirs:
-        pctx = repo[None].p1()
+        pctx = repo['.']
         dirs = set(pctx.dirs())
         files = {}
 
--- a/hgext/fastannotate/formatter.py	Fri Jan 25 23:36:23 2019 -0800
+++ b/hgext/fastannotate/formatter.py	Fri Jan 25 23:43:11 2019 -0800
@@ -38,8 +38,8 @@
         if self.opts.get('rev') == 'wdir()':
             orig = hexfunc
             hexfunc = lambda x: None if x is None else orig(x)
-            wnode = hexfunc(repo[None].p1().node()) + '+'
-            wrev = '%d' % repo[None].p1().rev()
+            wnode = hexfunc(repo['.'].node()) + '+'
+            wrev = '%d' % repo['.'].rev()
             wrevpad = ''
             if not opts.get('changeset'): # only show + if changeset is hidden
                 wrev += '+'
--- a/mercurial/commands.py	Fri Jan 25 23:36:23 2019 -0800
+++ b/mercurial/commands.py	Fri Jan 25 23:43:11 2019 -0800
@@ -1102,7 +1102,7 @@
 
     with repo.wlock():
         if opts.get('clean'):
-            label = repo[None].p1().branch()
+            label = repo['.'].branch()
             repo.dirstate.setbranch(label)
             ui.status(_('reset working directory to branch %s\n') % label)
         elif label:
@@ -1672,8 +1672,8 @@
         if not bheads:
             raise error.Abort(_('can only close branch heads'))
         elif opts.get('amend'):
-            if repo[None].p1().p1().branch() != branch and \
-                    repo[None].p1().p2().branch() != branch:
+            if repo['.'].p1().branch() != branch and \
+                    repo['.'].p2().branch() != branch:
                 raise error.Abort(_('can only close branch heads'))
 
     if opts.get('amend'):