[PATCH 1 of 3] strip: renaming local variables
Shubhanshu Agrawal
agrawal.shubhanshu at gmail.com
Mon Nov 16 14:05:00 CST 2015
# HG changeset patch
# User Shubhanshu Agrawal <agrawal.shubhanshu at gmail.com>
# Date 1447599447 -19800
# Sun Nov 15 20:27:27 2015 +0530
# Node ID 0d18b7f577b8d8a353c668c8b9d93cf4cfd5b129
# Parent 2da6a2dbfc42bdec4bcaf47da947c64ff959a59c
strip: renaming local variables
Renaming local variables to be more precise, i want to store
a different list of bookmarks and it would be hard to
understand what marks represents in that change therefore
renaming it to repomarks. Renamed bookmarks(module)
to bookmarksmod as to free up bookmarks which will be
used when plurazing bookmark.
diff -r 2da6a2dbfc42 -r 0d18b7f577b8 hgext/strip.py
--- a/hgext/strip.py Mon Nov 09 17:20:50 2015 -0500
+++ b/hgext/strip.py Sun Nov 15 20:27:27 2015 +0530
@@ -7,7 +7,7 @@
from mercurial.node import nullid
from mercurial.lock import release
from mercurial import cmdutil, hg, scmutil, util, error
-from mercurial import repair, bookmarks, merge
+from mercurial import repair, bookmarks as bookmarksmod , merge
cmdtable = {}
command = cmdutil.command(cmdtable)
@@ -62,12 +62,12 @@
repair.strip(ui, repo, revs, backup)
- marks = repo._bookmarks
+ repomarks = repo._bookmarks
if bookmark:
if bookmark == repo._activebookmark:
- bookmarks.deactivate(repo)
- del marks[bookmark]
- marks.write()
+ bookmarksmod.deactivate(repo)
+ del repomarks[bookmark]
+ repomarks.write()
ui.write(_("bookmark '%s' deleted\n") % bookmark)
finally:
release(lock, wlock)
@@ -127,27 +127,27 @@
wlock = repo.wlock()
try:
- if opts.get('bookmark'):
- mark = opts.get('bookmark')
- marks = repo._bookmarks
- if mark not in marks:
- raise error.Abort(_("bookmark '%s' not found") % mark)
+ bookmark = opts.get('bookmark')
+ if bookmark:
+ repomarks = repo._bookmarks
+ if bookmark not in repomarks:
+ raise error.Abort(_("bookmark '%s' not found") % bookmark)
# If the requested bookmark is not the only one pointing to a
# a revision we have to only delete the bookmark and not strip
# anything. revsets cannot detect that case.
uniquebm = True
- for m, n in marks.iteritems():
- if m != mark and n == repo[mark].node():
+ for m, n in repomarks.iteritems():
+ if m != bookmark and n == repo[bookmark].node():
uniquebm = False
break
if uniquebm:
- rsrevs = repair.stripbmrevset(repo, mark)
+ rsrevs = repair.stripbmrevset(repo, bookmark)
revs.update(set(rsrevs))
if not revs:
- del marks[mark]
- marks.write()
- ui.write(_("bookmark '%s' deleted\n") % mark)
+ del repomarks[bookmark]
+ repomarks.write()
+ ui.write(_("bookmark '%s' deleted\n") % bookmark)
if not revs:
raise error.Abort(_('empty revision set'))
@@ -215,7 +215,7 @@
strip(ui, repo, revs, backup=backup, update=update,
- force=opts.get('force'), bookmark=opts.get('bookmark'))
+ force=opts.get('force'), bookmark=bookmark)
finally:
wlock.release()
More information about the Mercurial-devel
mailing list