From patchwork Tue Jul 15 19:51:16 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [V2] strip: remove -b/--backup codepaths From: =?utf-8?q?Jordi_Guti=C3=A9rrez_Hermoso?= X-Patchwork-Id: 5171 Message-Id: To: mercurial-devel@selenic.com Date: Tue, 15 Jul 2014 15:51:16 -0400 # HG changeset patch # User Jordi GutiƩrrez Hermoso # Date 1404603671 14400 # Sat Jul 05 19:41:11 2014 -0400 # Node ID acd5e49b3940443d411d5a0aad446fc31ce6ab65 # Parent ba3bc6474bbf3a29e5fa16d13ff44b9c0848043c strip: remove -b/--backup codepaths cset ba3bc6474bbf has removed this option. This commit just tidies the code that was associated to it. diff --git a/hgext/strip.py b/hgext/strip.py --- a/hgext/strip.py +++ b/hgext/strip.py @@ -42,7 +42,7 @@ def checklocalchanges(repo, force=False, raise util.Abort(_("local changed subrepos found" + excsuffix)) return m, a, r, d -def strip(ui, repo, revs, update=True, backup="all", force=None, bookmark=None): +def strip(ui, repo, revs, update=True, backup=True, force=None, bookmark=None): wlock = lock = None try: wlock = repo.wlock() @@ -114,11 +114,9 @@ def stripcmd(ui, repo, *revs, **opts): Return 0 on success. """ - backup = 'all' - if opts.get('backup'): - backup = 'strip' - elif opts.get('no_backup') or opts.get('nobackup'): - backup = 'none' + backup = True + if opts.get('no_backup') or opts.get('nobackup'): + backup = False cl = repo.changelog revs = list(revs) + opts.get('rev') diff --git a/mercurial/repair.py b/mercurial/repair.py --- a/mercurial/repair.py +++ b/mercurial/repair.py @@ -47,7 +47,7 @@ def _collectbrokencsets(repo, files, str return s -def strip(ui, repo, nodelist, backup="all", topic='backup'): +def strip(ui, repo, nodelist, backup=True, topic='backup'): repo = repo.unfiltered() repo.destroying() @@ -58,8 +58,6 @@ def strip(ui, repo, nodelist, backup="al striplist = [cl.rev(node) for node in nodelist] striprev = min(striplist) - keeppartialbundle = backup == 'strip' - # Some revisions with rev > striprev may not be descendants of striprev. # We have to find these revisions and put them in a bundle, so that # we can restore them after the truncations. @@ -109,7 +107,7 @@ def strip(ui, repo, nodelist, backup="al # create a changegroup for all the branches we need to keep backupfile = None vfs = repo.vfs - if backup == "all": + if backup: backupfile = _bundle(repo, stripbases, cl.heads(), node, topic) repo.ui.status(_("saved backup bundle to %s\n") % vfs.join(backupfile)) @@ -118,7 +116,7 @@ def strip(ui, repo, nodelist, backup="al if saveheads or savebases: # do not compress partial bundle if we remove it from disk later chgrpfile = _bundle(repo, savebases, saveheads, node, 'temp', - compress=keeppartialbundle) + compress=False) mfst = repo.manifest @@ -156,8 +154,8 @@ def strip(ui, repo, nodelist, backup="al if not repo.ui.verbose: repo.ui.popbuffer() f.close() - if not keeppartialbundle: - vfs.unlink(chgrpfile) + + vfs.unlink(chgrpfile) # remove undo files for undovfs, undofile in repo.undofiles():