Show More
@@ -1173,7 +1173,7 b' def _finishhistedit(ui, repo, state):' | |||||
1173 |
|
1173 | |||
1174 | if not state.keep: |
|
1174 | if not state.keep: | |
1175 | if mapping: |
|
1175 | if mapping: | |
1176 |
movebookmarks( |
|
1176 | movetopmostbookmarks(repo, state.topmost, ntm) | |
1177 | # TODO update mq state |
|
1177 | # TODO update mq state | |
1178 | else: |
|
1178 | else: | |
1179 | mapping = {} |
|
1179 | mapping = {} | |
@@ -1181,7 +1181,11 b' def _finishhistedit(ui, repo, state):' | |||||
1181 | for n in tmpnodes: |
|
1181 | for n in tmpnodes: | |
1182 | mapping[n] = () |
|
1182 | mapping[n] = () | |
1183 |
|
1183 | |||
1184 | safecleanupnode(ui, repo, mapping) |
|
1184 | # remove entries about unknown nodes | |
|
1185 | nodemap = repo.unfiltered().changelog.nodemap | |||
|
1186 | mapping = {k: v for k, v in mapping.items() | |||
|
1187 | if k in nodemap and all(n in nodemap for n in v)} | |||
|
1188 | scmutil.cleanupnodes(repo, mapping, 'histedit') | |||
1185 |
|
1189 | |||
1186 | state.clear() |
|
1190 | state.clear() | |
1187 | if os.path.exists(repo.sjoin('undo')): |
|
1191 | if os.path.exists(repo.sjoin('undo')): | |
@@ -1561,38 +1565,6 b' def movetopmostbookmarks(repo, oldtopmos' | |||||
1561 | marks[name] = newtopmost |
|
1565 | marks[name] = newtopmost | |
1562 | marks.recordchange(tr) |
|
1566 | marks.recordchange(tr) | |
1563 |
|
1567 | |||
1564 | def movebookmarks(ui, repo, mapping, oldtopmost, newtopmost): |
|
|||
1565 | """Move bookmark from old to newly created node""" |
|
|||
1566 | if not mapping: |
|
|||
1567 | # if nothing got rewritten there is not purpose for this function |
|
|||
1568 | return |
|
|||
1569 | movetopmostbookmarks(repo, oldtopmost, newtopmost) |
|
|||
1570 | moves = [] |
|
|||
1571 | for bk, old in sorted(repo._bookmarks.iteritems()): |
|
|||
1572 | base = old |
|
|||
1573 | new = mapping.get(base, None) |
|
|||
1574 | if new is None: |
|
|||
1575 | continue |
|
|||
1576 | while not new: |
|
|||
1577 | # base is killed, trying with parent |
|
|||
1578 | base = repo[base].p1().node() |
|
|||
1579 | new = mapping.get(base, (base,)) |
|
|||
1580 | # nothing to move |
|
|||
1581 | moves.append((bk, new[-1])) |
|
|||
1582 | if moves: |
|
|||
1583 | lock = tr = None |
|
|||
1584 | try: |
|
|||
1585 | lock = repo.lock() |
|
|||
1586 | tr = repo.transaction('histedit') |
|
|||
1587 | marks = repo._bookmarks |
|
|||
1588 | for mark, new in moves: |
|
|||
1589 | old = marks[mark] |
|
|||
1590 | marks[mark] = new |
|
|||
1591 | marks.recordchange(tr) |
|
|||
1592 | tr.close() |
|
|||
1593 | finally: |
|
|||
1594 | release(tr, lock) |
|
|||
1595 |
|
||||
1596 | def cleanupnode(ui, repo, nodes): |
|
1568 | def cleanupnode(ui, repo, nodes): | |
1597 | """strip a group of nodes from the repository |
|
1569 | """strip a group of nodes from the repository | |
1598 |
|
1570 | |||
@@ -1610,34 +1582,6 b' def cleanupnode(ui, repo, nodes):' | |||||
1610 | if roots: |
|
1582 | if roots: | |
1611 | repair.strip(ui, repo, roots) |
|
1583 | repair.strip(ui, repo, roots) | |
1612 |
|
1584 | |||
1613 | def safecleanupnode(ui, repo, nodes): |
|
|||
1614 | """strip or obsolete nodes |
|
|||
1615 |
|
||||
1616 | nodes could be either a set or dict which maps to replacements. |
|
|||
1617 | nodes could be unknown (outside the repo). |
|
|||
1618 | """ |
|
|||
1619 | supportsmarkers = obsolete.isenabled(repo, obsolete.createmarkersopt) |
|
|||
1620 | if supportsmarkers: |
|
|||
1621 | if util.safehasattr(nodes, 'get'): |
|
|||
1622 | # nodes is a dict-like mapping |
|
|||
1623 | # use unfiltered repo for successors in case they are hidden |
|
|||
1624 | urepo = repo.unfiltered() |
|
|||
1625 | def getmarker(prec): |
|
|||
1626 | succs = tuple(urepo[n] for n in nodes.get(prec, ())) |
|
|||
1627 | return (repo[prec], succs) |
|
|||
1628 | else: |
|
|||
1629 | # nodes is a set-like |
|
|||
1630 | def getmarker(prec): |
|
|||
1631 | return (repo[prec], ()) |
|
|||
1632 | # sort by revision number because it sound "right" |
|
|||
1633 | sortednodes = sorted([n for n in nodes if n in repo], |
|
|||
1634 | key=repo.changelog.rev) |
|
|||
1635 | markers = [getmarker(t) for t in sortednodes] |
|
|||
1636 | if markers: |
|
|||
1637 | obsolete.createmarkers(repo, markers, operation='histedit') |
|
|||
1638 | else: |
|
|||
1639 | return cleanupnode(ui, repo, nodes) |
|
|||
1640 |
|
||||
1641 | def stripwrapper(orig, ui, repo, nodelist, *args, **kwargs): |
|
1585 | def stripwrapper(orig, ui, repo, nodelist, *args, **kwargs): | |
1642 | if isinstance(nodelist, str): |
|
1586 | if isinstance(nodelist, str): | |
1643 | nodelist = [nodelist] |
|
1587 | nodelist = [nodelist] |
@@ -147,7 +147,7 b' temporarily.' | |||||
147 | $ mv .hg/histedit-state.back .hg/histedit-state |
|
147 | $ mv .hg/histedit-state.back .hg/histedit-state | |
148 |
|
148 | |||
149 | $ hg histedit --continue |
|
149 | $ hg histedit --continue | |
150 |
saved backup bundle to $TESTTMP/foo/.hg/strip-backup/08d98a8350f3-02594089- |
|
150 | saved backup bundle to $TESTTMP/foo/.hg/strip-backup/08d98a8350f3-02594089-histedit.hg (glob) | |
151 | $ hg log -G -T '{rev} {shortest(node)} {desc}\n' -r 2:: |
|
151 | $ hg log -G -T '{rev} {shortest(node)} {desc}\n' -r 2:: | |
152 | @ 4 f5ed five |
|
152 | @ 4 f5ed five | |
153 | | |
|
153 | | | |
@@ -157,7 +157,7 b' temporarily.' | |||||
157 | | |
|
157 | | | |
158 | ~ |
|
158 | ~ | |
159 |
|
159 | |||
160 |
$ hg unbundle -q $TESTTMP/foo/.hg/strip-backup/08d98a8350f3-02594089- |
|
160 | $ hg unbundle -q $TESTTMP/foo/.hg/strip-backup/08d98a8350f3-02594089-histedit.hg | |
161 | $ hg strip -q -r f5ed --config extensions.strip= |
|
161 | $ hg strip -q -r f5ed --config extensions.strip= | |
162 | $ hg up -q 08d98a8350f3 |
|
162 | $ hg up -q 08d98a8350f3 | |
163 |
|
163 | |||
@@ -264,7 +264,7 b' short hash. This tests issue3893.' | |||||
264 | HG: user: test |
|
264 | HG: user: test | |
265 | HG: branch 'default' |
|
265 | HG: branch 'default' | |
266 | HG: changed alpha |
|
266 | HG: changed alpha | |
267 |
saved backup bundle to $TESTTMP/foo/.hg/strip-backup/ |
|
267 | saved backup bundle to $TESTTMP/foo/.hg/strip-backup/c8e68270e35a-63d8b8d8-histedit.hg (glob) | |
268 |
|
268 | |||
269 | $ hg update -q 2 |
|
269 | $ hg update -q 2 | |
270 | $ echo x > x |
|
270 | $ echo x > x |
@@ -87,7 +87,7 b'' | |||||
87 | > fold e860deea161a 4 e |
|
87 | > fold e860deea161a 4 e | |
88 | > pick 652413bf663e 5 f |
|
88 | > pick 652413bf663e 5 f | |
89 | > EOF |
|
89 | > EOF | |
90 |
saved backup bundle to $TESTTMP/r/.hg/strip-backup/96e494a2d553-45c027ab- |
|
90 | saved backup bundle to $TESTTMP/r/.hg/strip-backup/96e494a2d553-45c027ab-histedit.hg (glob) | |
91 | $ hg log --graph |
|
91 | $ hg log --graph | |
92 | @ changeset: 3:cacdfd884a93 |
|
92 | @ changeset: 3:cacdfd884a93 | |
93 | | bookmark: five |
|
93 | | bookmark: five | |
@@ -141,7 +141,7 b'' | |||||
141 | > pick cacdfd884a93 3 f |
|
141 | > pick cacdfd884a93 3 f | |
142 | > pick 59d9f330561f 2 d |
|
142 | > pick 59d9f330561f 2 d | |
143 | > EOF |
|
143 | > EOF | |
144 |
saved backup bundle to $TESTTMP/r/.hg/strip-backup/59d9f330561f-073008af- |
|
144 | saved backup bundle to $TESTTMP/r/.hg/strip-backup/59d9f330561f-073008af-histedit.hg (glob) | |
145 |
|
145 | |||
146 | We expect 'five' to stay at tip, since the tipmost bookmark is most |
|
146 | We expect 'five' to stay at tip, since the tipmost bookmark is most | |
147 | likely the useful signal. |
|
147 | likely the useful signal. |
@@ -417,7 +417,7 b" Now, let's try to fold the second commit" | |||||
417 | > EOF |
|
417 | > EOF | |
418 |
|
418 | |||
419 | $ HGEDITOR="sh ./editor.sh" hg histedit 0 |
|
419 | $ HGEDITOR="sh ./editor.sh" hg histedit 0 | |
420 |
saved backup bundle to $TESTTMP/issue4251/.hg/strip-backup/ |
|
420 | saved backup bundle to $TESTTMP/issue4251/.hg/strip-backup/b0f4233702ca-4cf5af69-histedit.hg (glob) | |
421 |
|
421 | |||
422 | $ hg --config diff.git=yes export 0 |
|
422 | $ hg --config diff.git=yes export 0 | |
423 | # HG changeset patch |
|
423 | # HG changeset patch |
@@ -273,7 +273,7 b' check histedit_source' | |||||
273 | HG: user: test |
|
273 | HG: user: test | |
274 | HG: branch 'default' |
|
274 | HG: branch 'default' | |
275 | HG: added f |
|
275 | HG: added f | |
276 |
saved backup bundle to $TESTTMP/r/.hg/strip-backup/b5f70786f9b0-c28d9c86- |
|
276 | saved backup bundle to $TESTTMP/r/.hg/strip-backup/b5f70786f9b0-c28d9c86-histedit.hg (glob) | |
277 |
|
277 | |||
278 | $ hg status |
|
278 | $ hg status | |
279 |
|
279 | |||
@@ -437,7 +437,7 b' rollback should not work after a histedi' | |||||
437 | (hg histedit --continue to resume) |
|
437 | (hg histedit --continue to resume) | |
438 | [1] |
|
438 | [1] | |
439 | $ HGEDITOR=true hg histedit --continue |
|
439 | $ HGEDITOR=true hg histedit --continue | |
440 |
saved backup bundle to $TESTTMP/r0/.hg/strip-backup/cb9a9f314b8b-cc5ccb0b- |
|
440 | saved backup bundle to $TESTTMP/r0/.hg/strip-backup/cb9a9f314b8b-cc5ccb0b-histedit.hg (glob) | |
441 |
|
441 | |||
442 | $ hg log -G |
|
442 | $ hg log -G | |
443 | @ changeset: 0:0efcea34f18a |
|
443 | @ changeset: 0:0efcea34f18a |
@@ -305,7 +305,7 b' should effectively drop the changes from' | |||||
305 | continue: hg histedit --continue |
|
305 | continue: hg histedit --continue | |
306 | $ hg histedit --continue |
|
306 | $ hg histedit --continue | |
307 | 251d831eeec5: empty changeset |
|
307 | 251d831eeec5: empty changeset | |
308 |
saved backup bundle to $TESTTMP/ |
|
308 | saved backup bundle to $TESTTMP/fold-to-empty-test/.hg/strip-backup/888f9082bf99-daa0b8b3-histedit.hg (glob) | |
309 | $ hg logt --graph |
|
309 | $ hg logt --graph | |
310 | @ 1:617f94f13c0f +4 |
|
310 | @ 1:617f94f13c0f +4 | |
311 | | |
|
311 | | | |
@@ -382,7 +382,7 b' dropped revision.' | |||||
382 | HG: user: test |
|
382 | HG: user: test | |
383 | HG: branch 'default' |
|
383 | HG: branch 'default' | |
384 | HG: changed file |
|
384 | HG: changed file | |
385 |
saved backup bundle to $TESTTMP/fold-with-dropped/.hg/strip-backup/617f94f13c0f-3d69522c- |
|
385 | saved backup bundle to $TESTTMP/fold-with-dropped/.hg/strip-backup/617f94f13c0f-3d69522c-histedit.hg (glob) | |
386 | $ hg logt -G |
|
386 | $ hg logt -G | |
387 | @ 1:10c647b2cdd5 +4 |
|
387 | @ 1:10c647b2cdd5 +4 | |
388 | | |
|
388 | | |
General Comments 0
You need to be logged in to leave comments.
Login now