Show More
@@ -2925,6 +2925,10 b' def strip(ui, repo, *revs, **opts):' | |||
|
2925 | 2925 | Use the --no-backup option to discard the backup bundle once the |
|
2926 | 2926 | operation completes. |
|
2927 | 2927 | |
|
2928 | Strip is not a history-rewriting operation and can be used on | |
|
2929 | changesets in the public phase. But if the stripped changesets have | |
|
2930 | been pushed to a remote repository you will likely pull them again. | |
|
2931 | ||
|
2928 | 2932 | Return 0 on success. |
|
2929 | 2933 | """ |
|
2930 | 2934 | backup = 'all' |
@@ -238,6 +238,9 b' def rebase(ui, repo, **opts):' | |||
|
238 | 238 | |
|
239 | 239 | # Keep track of the current bookmarks in order to reset them later |
|
240 | 240 | currentbookmarks = repo._bookmarks.copy() |
|
241 | activebookmark = repo._bookmarkcurrent | |
|
242 | if activebookmark: | |
|
243 | bookmarks.unsetcurrent(repo) | |
|
241 | 244 | |
|
242 | 245 | sortedstate = sorted(state) |
|
243 | 246 | total = len(sortedstate) |
@@ -327,6 +330,11 b' def rebase(ui, repo, **opts):' | |||
|
327 | 330 | util.unlinkpath(repo.sjoin('undo')) |
|
328 | 331 | if skipped: |
|
329 | 332 | ui.note(_("%d revisions have been skipped\n") % len(skipped)) |
|
333 | ||
|
334 | if (activebookmark and | |
|
335 | repo['tip'].node() == repo._bookmarks[activebookmark]): | |
|
336 | bookmarks.setcurrent(repo, activebookmark) | |
|
337 | ||
|
330 | 338 | finally: |
|
331 | 339 | release(lock, wlock) |
|
332 | 340 | |
@@ -476,13 +484,11 b' def updatemq(repo, state, skipped, **opt' | |||
|
476 | 484 | |
|
477 | 485 | def updatebookmarks(repo, nstate, originalbookmarks, **opts): |
|
478 | 486 | 'Move bookmarks to their correct changesets' |
|
479 | current = repo._bookmarkcurrent | |
|
480 | 487 | for k, v in originalbookmarks.iteritems(): |
|
481 | 488 | if v in nstate: |
|
482 | 489 | if nstate[v] != nullmerge: |
|
483 |
# |
|
|
484 | if k != current: | |
|
485 | repo._bookmarks[k] = nstate[v] | |
|
490 | # update the bookmarks for revs that have moved | |
|
491 | repo._bookmarks[k] = nstate[v] | |
|
486 | 492 | |
|
487 | 493 | bookmarks.write(repo) |
|
488 | 494 |
@@ -1301,7 +1301,11 b' def amend(ui, repo, commitfunc, old, ext' | |||
|
1301 | 1301 | try: |
|
1302 | 1302 | # First, do a regular commit to record all changes in the working |
|
1303 | 1303 | # directory (if there are any) |
|
1304 | node = commit(ui, repo, commitfunc, pats, opts) | |
|
1304 | ui.callhooks = False | |
|
1305 | try: | |
|
1306 | node = commit(ui, repo, commitfunc, pats, opts) | |
|
1307 | finally: | |
|
1308 | ui.callhooks = True | |
|
1305 | 1309 | ctx = repo[node] |
|
1306 | 1310 | |
|
1307 | 1311 | # Participating changesets: |
@@ -2752,11 +2752,6 b' def graft(ui, repo, *revs, **opts):' | |||
|
2752 | 2752 | ctx.p1().node()) |
|
2753 | 2753 | finally: |
|
2754 | 2754 | repo.ui.setconfig('ui', 'forcemerge', '') |
|
2755 | # drop the second merge parent | |
|
2756 | repo.setparents(current.node(), nullid) | |
|
2757 | repo.dirstate.write() | |
|
2758 | # fix up dirstate for copies and renames | |
|
2759 | cmdutil.duplicatecopies(repo, ctx.rev(), ctx.p1().rev()) | |
|
2760 | 2755 | # report any conflicts |
|
2761 | 2756 | if stats and stats[3] > 0: |
|
2762 | 2757 | # write out state for --continue |
@@ -2768,6 +2763,12 b' def graft(ui, repo, *revs, **opts):' | |||
|
2768 | 2763 | else: |
|
2769 | 2764 | cont = False |
|
2770 | 2765 | |
|
2766 | # drop the second merge parent | |
|
2767 | repo.setparents(current.node(), nullid) | |
|
2768 | repo.dirstate.write() | |
|
2769 | # fix up dirstate for copies and renames | |
|
2770 | cmdutil.duplicatecopies(repo, ctx.rev(), ctx.p1().rev()) | |
|
2771 | ||
|
2771 | 2772 | # commit |
|
2772 | 2773 | source = ctx.extra().get('source') |
|
2773 | 2774 | if not source: |
@@ -138,6 +138,9 b' def redirect(state):' | |||
|
138 | 138 | _redirect = state |
|
139 | 139 | |
|
140 | 140 | def hook(ui, repo, name, throw=False, **args): |
|
141 | if not ui.callhooks: | |
|
142 | return False | |
|
143 | ||
|
141 | 144 | r = False |
|
142 | 145 | |
|
143 | 146 | oldstdout = -1 |
@@ -19,6 +19,7 b' class ui(object):' | |||
|
19 | 19 | self._ucfg = config.config() # untrusted |
|
20 | 20 | self._trustusers = set() |
|
21 | 21 | self._trustgroups = set() |
|
22 | self.callhooks = True | |
|
22 | 23 | |
|
23 | 24 | if src: |
|
24 | 25 | self.fout = src.fout |
@@ -31,6 +32,7 b' class ui(object):' | |||
|
31 | 32 | self._trustusers = src._trustusers.copy() |
|
32 | 33 | self._trustgroups = src._trustgroups.copy() |
|
33 | 34 | self.environ = src.environ |
|
35 | self.callhooks = src.callhooks | |
|
34 | 36 | self.fixconfig() |
|
35 | 37 | else: |
|
36 | 38 | self.fout = sys.stdout |
@@ -23,11 +23,17 b' Nothing to amend:' | |||
|
23 | 23 | nothing changed |
|
24 | 24 | [1] |
|
25 | 25 | |
|
26 | $ echo '[hooks]' >> $HGRCPATH | |
|
27 | $ echo 'pretxncommit.foo = echo "pretxncommit $HG_NODE"; hg id -r $HG_NODE' >> $HGRCPATH | |
|
28 | ||
|
26 | 29 | Amending changeset with changes in working dir: |
|
27 | 30 | |
|
28 | 31 | $ echo a >> a |
|
29 | 32 | $ hg ci --amend -m 'amend base1' |
|
30 | saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-amend-backup.hg (glob) | |
|
33 | pretxncommit 9cd25b479c51be2f4ed2c38e7abdf7ce67d8e0dc | |
|
34 | 9cd25b479c51 tip | |
|
35 | saved backup bundle to $TESTTMP/.hg/strip-backup/489edb5b847d-amend-backup.hg | |
|
36 | $ echo 'pretxncommit.foo = ' >> $HGRCPATH | |
|
31 | 37 | $ hg diff -c . |
|
32 | 38 | diff -r ad120869acf0 -r 9cd25b479c51 a |
|
33 | 39 | --- a/a Thu Jan 01 00:00:00 1970 +0000 |
@@ -304,4 +304,57 b' Graft with --log' | |||
|
304 | 304 | 14 1:5d205f8b35b6 3 |
|
305 | 305 | (grafted from 4c60f11aa304a54ae1c199feb94e7fc771e51ed8) |
|
306 | 306 | |
|
307 | $ cd .. | |
|
307 | Resolve conflicted graft | |
|
308 | $ hg up -q 0 | |
|
309 | $ echo b > a | |
|
310 | $ hg ci -m 8 | |
|
311 | created new head | |
|
312 | $ echo a > a | |
|
313 | $ hg ci -m 9 | |
|
314 | $ hg graft 1 --tool internal:fail | |
|
315 | grafting revision 1 | |
|
316 | abort: unresolved conflicts, can't continue | |
|
317 | (use hg resolve and hg graft --continue) | |
|
318 | [255] | |
|
319 | $ hg resolve --all | |
|
320 | merging a | |
|
321 | $ hg graft -c | |
|
322 | grafting revision 1 | |
|
323 | $ hg export tip --git | |
|
324 | # HG changeset patch | |
|
325 | # User bar | |
|
326 | # Date 0 0 | |
|
327 | # Node ID 64ecd9071ce83c6e62f538d8ce7709d53f32ebf7 | |
|
328 | # Parent 4bdb9a9d0b84ffee1d30f0dfc7744cade17aa19c | |
|
329 | 1 | |
|
330 | ||
|
331 | diff --git a/a b/a | |
|
332 | --- a/a | |
|
333 | +++ b/a | |
|
334 | @@ -1,1 +1,1 @@ | |
|
335 | -a | |
|
336 | +b | |
|
337 | ||
|
338 | Resolve conflicted graft with rename | |
|
339 | $ echo c > a | |
|
340 | $ hg ci -m 10 | |
|
341 | $ hg graft 2 --tool internal:fail | |
|
342 | grafting revision 2 | |
|
343 | abort: unresolved conflicts, can't continue | |
|
344 | (use hg resolve and hg graft --continue) | |
|
345 | [255] | |
|
346 | $ hg resolve --all | |
|
347 | merging a and b to b | |
|
348 | $ hg graft -c | |
|
349 | grafting revision 2 | |
|
350 | $ hg export tip --git | |
|
351 | # HG changeset patch | |
|
352 | # User test | |
|
353 | # Date 0 0 | |
|
354 | # Node ID 2e80e1351d6ed50302fe1e05f8bd1d4d412b6e11 | |
|
355 | # Parent e5a51ae854a8bbaaf25cc5c6a57ff46042dadbb4 | |
|
356 | 2 | |
|
357 | ||
|
358 | diff --git a/a b/b | |
|
359 | rename from a | |
|
360 | rename to b |
@@ -36,8 +36,10 b' Create a repo with several bookmarks' | |||
|
36 | 36 | adding d |
|
37 | 37 | created new head |
|
38 | 38 | |
|
39 | $ hg book W | |
|
40 | ||
|
39 | 41 | $ hg tglog |
|
40 | @ 3: 'D' bookmarks: | |
|
42 | @ 3: 'D' bookmarks: W | |
|
41 | 43 | | |
|
42 | 44 | | o 2: 'C' bookmarks: Y Z |
|
43 | 45 | | | |
@@ -60,7 +62,7 b' Move only rebased bookmarks' | |||
|
60 | 62 | $ hg tglog |
|
61 | 63 | @ 3: 'C' bookmarks: Y Z |
|
62 | 64 | | |
|
63 | o 2: 'D' bookmarks: | |
|
65 | o 2: 'D' bookmarks: W | |
|
64 | 66 | | |
|
65 | 67 | | o 1: 'B' bookmarks: X |
|
66 | 68 | |/ |
@@ -82,7 +84,28 b' Keep bookmarks to the correct rebased ch' | |||
|
82 | 84 | | |
|
83 | 85 | o 2: 'B' bookmarks: X |
|
84 | 86 | | |
|
85 | o 1: 'D' bookmarks: | |
|
87 | o 1: 'D' bookmarks: W | |
|
88 | | | |
|
89 | o 0: 'A' bookmarks: | |
|
90 | ||
|
91 | ||
|
92 | Keep active bookmark on the correct changeset | |
|
93 | ||
|
94 | $ cd .. | |
|
95 | $ hg clone -q a a3 | |
|
96 | ||
|
97 | $ cd a3 | |
|
98 | $ hg up -q X | |
|
99 | ||
|
100 | $ hg rebase -d W | |
|
101 | saved backup bundle to $TESTTMP/a3/.hg/strip-backup/*-backup.hg (glob) | |
|
102 | ||
|
103 | $ hg tglog | |
|
104 | @ 3: 'C' bookmarks: Y Z | |
|
105 | | | |
|
106 | o 2: 'B' bookmarks: X | |
|
107 | | | |
|
108 | o 1: 'D' bookmarks: W | |
|
86 | 109 | | |
|
87 | 110 | o 0: 'A' bookmarks: |
|
88 | 111 |
General Comments 0
You need to be logged in to leave comments.
Login now