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