Patchwork strip: remove -b/--backup codepaths

login
register
mail settings
Submitter Jordi Gutiérrez Hermoso
Date July 12, 2014, 9:10 p.m.
Message ID <9f4783ceb299537e3851.1405199402@Iris>
Download mbox | patch
Permalink /patch/5154/
State Superseded
Commit 445472225ccd07c27323cab59c4a1bf728f76142
Headers show

Comments

Jordi Gutiérrez Hermoso - July 12, 2014, 9:10 p.m.
# HG changeset patch
# User Jordi Gutiérrez Hermoso <jordigh@octave.org>
# Date 1404603671 14400
#      Sat Jul 05 19:41:11 2014 -0400
# Node ID 9f4783ceb299537e38513d7c1e2ed2185c19d4cb
# Parent  ba3bc6474bbf3a29e5fa16d13ff44b9c0848043c
strip: remove -b/--backup codepaths

cset ba3bc6474bbf has removed this option. This commit just tidies the
code that was associated to it.
Jordi Gutiérrez Hermoso - July 12, 2014, 9:17 p.m.
On Sat, 2014-07-12 at 17:10 -0400, Jordi Gutiérrez Hermoso wrote:
> # HG changeset patch
> # User Jordi Gutiérrez Hermoso <jordigh@octave.org>
> # Date 1404603671 14400
> #      Sat Jul 05 19:41:11 2014 -0400
> # Node ID 9f4783ceb299537e38513d7c1e2ed2185c19d4cb
> # Parent  ba3bc6474bbf3a29e5fa16d13ff44b9c0848043c
> strip: remove -b/--backup codepaths
[snip]
> -def strip(ui, repo, revs, update=True, backup="all", force=None, bookmark=None):
> +def strip(ui, repo, revs, update=True, backup=True, force=None):

This hunk was sent in error. I will amend and resend.

- Jordi G. H.

Patch

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):
     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():