##// END OF EJS Templates
strip: simplify bundle helper
Matt Mackall -
r4701:d2da07fb default
parent child Browse files
Show More
@@ -60,12 +60,12 b' def _strip(ui, repo, rev, backup="all"):'
60 p[pn] = 1
60 p[pn] = 1
61 return h
61 return h
62
62
63 def bundle(cg):
63 def bundle(repo, bases, heads, rev, suffix):
64 cg = repo.changegroupsubset(bases, heads, 'strip')
64 backupdir = repo.join("strip-backup")
65 backupdir = repo.join("strip-backup")
65 if not os.path.isdir(backupdir):
66 if not os.path.isdir(backupdir):
66 os.mkdir(backupdir)
67 os.mkdir(backupdir)
67 name = os.path.join(backupdir, "%s" % revlog.short(rev))
68 name = os.path.join(backupdir, "%s-%s" % (revlog.short(rev), suffix))
68 name = savename(name)
69 ui.warn("saving bundle to %s\n" % name)
69 ui.warn("saving bundle to %s\n" % name)
70 return changegroup.writebundle(cg, name, "HG10BZ")
70 return changegroup.writebundle(cg, name, "HG10BZ")
71
71
@@ -141,11 +141,9 b' def _strip(ui, repo, rev, backup="all"):'
141
141
142 # create a changegroup for all the branches we need to keep
142 # create a changegroup for all the branches we need to keep
143 if backup == "all":
143 if backup == "all":
144 backupch = repo.changegroupsubset([rev], chlog.heads(), 'strip')
144 bundle(repo, [rev], chlog.heads(), rev, 'backup')
145 bundle(backupch)
146 if saveheads:
145 if saveheads:
147 backupch = repo.changegroupsubset(savebases.keys(), saveheads, 'strip')
146 chgrpfile = bundle(repo, savebases.keys(), saveheads, rev, 'temp')
148 chgrpfile = bundle(backupch)
149
147
150 stripall(revnum)
148 stripall(revnum)
151
149
General Comments 0
You need to be logged in to leave comments. Login now