From patchwork Mon Nov 16 20:52:33 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [1,of,3,v4] strip: renaming local variables From: Shubhanshu Agrawal X-Patchwork-Id: 11411 Message-Id: <0d18b7f577b8d8a353c6.1447707153@waste.org> To: mercurial-devel@selenic.com Date: Mon, 16 Nov 2015 14:52:33 -0600 # HG changeset patch # User Shubhanshu Agrawal # 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 --git a/hgext/strip.py b/hgext/strip.py --- a/hgext/strip.py +++ b/hgext/strip.py @@ -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()