changeset 4701:d2da07fb5727

strip: simplify bundle helper
author Matt Mackall <mpm@selenic.com>
date Mon, 25 Jun 2007 01:22:45 -0500
parents a2e025fcd256
children 18e91c9def0c
files hgext/mq.py
diffstat 1 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Sun Jun 24 18:22:40 2007 -0500
+++ b/hgext/mq.py	Mon Jun 25 01:22:45 2007 -0500
@@ -60,12 +60,12 @@
                 p[pn] = 1
         return h
 
-    def bundle(cg):
+    def bundle(repo, bases, heads, rev, suffix):
+        cg = repo.changegroupsubset(bases, heads, 'strip')
         backupdir = repo.join("strip-backup")
         if not os.path.isdir(backupdir):
             os.mkdir(backupdir)
-        name = os.path.join(backupdir, "%s" % revlog.short(rev))
-        name = savename(name)
+        name = os.path.join(backupdir, "%s-%s" % (revlog.short(rev), suffix))
         ui.warn("saving bundle to %s\n" % name)
         return changegroup.writebundle(cg, name, "HG10BZ")
 
@@ -141,11 +141,9 @@
 
     # create a changegroup for all the branches we need to keep
     if backup == "all":
-        backupch = repo.changegroupsubset([rev], chlog.heads(), 'strip')
-        bundle(backupch)
+        bundle(repo, [rev], chlog.heads(), rev, 'backup')
     if saveheads:
-        backupch = repo.changegroupsubset(savebases.keys(), saveheads, 'strip')
-        chgrpfile = bundle(backupch)
+        chgrpfile = bundle(repo, savebases.keys(), saveheads, rev, 'temp')
 
     stripall(revnum)