##// END OF EJS Templates
strip: enhance repair.strip to receive a list of nodes (issue3299)...
Wagner Bruna -
r16252:cf17e76b stable
parent child Browse files
Show More
@@ -1043,8 +1043,7 b' class queue(object):'
1043 1043 repo.dirstate.write()
1044 1044
1045 1045 self.removeundo(repo)
1046 for rev in revs:
1047 repair.strip(self.ui, repo, rev, backup)
1046 repair.strip(self.ui, repo, revs, backup)
1048 1047 # strip may have unbundled a set of backed up revisions after
1049 1048 # the actual strip
1050 1049 self.removeundo(repo)
@@ -54,10 +54,13 b' def _collectbrokencsets(repo, files, str'
54 54
55 55 return s
56 56
57 def strip(ui, repo, node, backup="all"):
57 def strip(ui, repo, nodelist, backup="all"):
58 58 cl = repo.changelog
59 59 # TODO delete the undo files, and handle undo of merge sets
60 striprev = cl.rev(node)
60 if isinstance(nodelist, str):
61 nodelist = [nodelist]
62 striplist = [cl.rev(node) for node in nodelist]
63 striprev = min(striplist)
61 64
62 65 keeppartialbundle = backup == 'strip'
63 66
@@ -68,8 +71,10 b' def strip(ui, repo, node, backup="all"):'
68 71 # the list of heads and bases of the set of interesting revisions.
69 72 # (head = revision in the set that has no descendant in the set;
70 73 # base = revision in the set that has no ancestor in the set)
71 tostrip = set(cl.descendants(striprev))
72 tostrip.add(striprev)
74 tostrip = set(striplist)
75 for rev in striplist:
76 for desc in cl.descendants(rev):
77 tostrip.add(desc)
73 78
74 79 files = _collectfiles(repo, striprev)
75 80 saverevs = _collectbrokencsets(repo, files, striprev)
@@ -88,6 +93,7 b' def strip(ui, repo, node, backup="all"):'
88 93 descendants = set(cl.descendants(*saverevs))
89 94 saverevs.difference_update(descendants)
90 95 savebases = [cl.node(r) for r in saverevs]
96 stripbases = [cl.node(r) for r in tostrip]
91 97
92 98 bm = repo._bookmarks
93 99 updatebm = []
@@ -99,7 +105,7 b' def strip(ui, repo, node, backup="all"):'
99 105 # create a changegroup for all the branches we need to keep
100 106 backupfile = None
101 107 if backup == "all":
102 backupfile = _bundle(repo, [node], cl.heads(), node, 'backup')
108 backupfile = _bundle(repo, stripbases, cl.heads(), node, 'backup')
103 109 repo.ui.status(_("saved backup bundle to %s\n") % backupfile)
104 110 if saveheads or savebases:
105 111 # do not compress partial bundle if we remove it from disk later
@@ -311,7 +311,6 b' 2 different branches: 2 strips'
311 311 $ hg strip 2 4
312 312 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
313 313 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
314 saved backup bundle to $TESTTMP/test/.hg/strip-backup/*-backup.hg (glob)
315 314 $ hg glog
316 315 @ changeset: 2:65bd5f99a4a3
317 316 | tag: tip
@@ -421,3 +420,13 b' Verify strip protects against stripping '
421 420 $ hg status
422 421 M bar
423 422 ? b
423 $ cd ..
424
425 stripping many nodes on a complex graph (issue3299)
426
427 $ hg init issue3299
428 $ cd issue3299
429 $ hg debugbuilddag '@a.:a@b.:b.:x<a@a.:a<b@b.:b<a@a.:a'
430 $ hg strip 'not ancestors(x)'
431 saved backup bundle to $TESTTMP/issue3299/.hg/strip-backup/*-backup.hg (glob)
432
General Comments 0
You need to be logged in to leave comments. Login now