D5707: cleanup: use repo['.'] instead of repo[None].p1()
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Sat Jan 26 08:01:15 UTC 2019
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D5707
AFFECTED FILES
contrib/synthrepo.py
hgext/fastannotate/formatter.py
mercurial/commands.py
CHANGE DETAILS
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -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'):
diff --git a/hgext/fastannotate/formatter.py b/hgext/fastannotate/formatter.py
--- a/hgext/fastannotate/formatter.py
+++ b/hgext/fastannotate/formatter.py
@@ -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 += '+'
diff --git a/contrib/synthrepo.py b/contrib/synthrepo.py
--- a/contrib/synthrepo.py
+++ b/contrib/synthrepo.py
@@ -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 = {}
To: martinvonz, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list