Show More
@@ -0,0 +1,44 b'' | |||||
|
1 | Testing templating for rebase command | |||
|
2 | ||||
|
3 | Setup | |||
|
4 | ||||
|
5 | $ cat >> $HGRCPATH <<EOF | |||
|
6 | > [extensions] | |||
|
7 | > rebase= | |||
|
8 | > [experimental] | |||
|
9 | > evolution=createmarkers | |||
|
10 | > EOF | |||
|
11 | ||||
|
12 | $ hg init repo | |||
|
13 | $ cd repo | |||
|
14 | $ for ch in a b c d; do echo foo > $ch; hg commit -Aqm "Added "$ch; done | |||
|
15 | ||||
|
16 | $ hg log -G -T "{rev}:{node|short} {desc}" | |||
|
17 | @ 3:62615734edd5 Added d | |||
|
18 | | | |||
|
19 | o 2:28ad74487de9 Added c | |||
|
20 | | | |||
|
21 | o 1:29becc82797a Added b | |||
|
22 | | | |||
|
23 | o 0:18d04c59bb5d Added a | |||
|
24 | ||||
|
25 | Getting the JSON output for nodechanges | |||
|
26 | ||||
|
27 | $ hg rebase -s 2 -d 0 -q -Tjson | |||
|
28 | [ | |||
|
29 | { | |||
|
30 | "nodechanges": {"28ad74487de9599d00d81085be739c61fc340652": ["849767420fd5519cf0026232411a943ed03cc9fb"], "62615734edd52f06b6fb9c2beb429e4fe30d57b8": ["df21b32134ba85d86bca590cbe9b8b7cbc346c53"]} | |||
|
31 | } | |||
|
32 | ] | |||
|
33 | ||||
|
34 | $ hg log -G -T "{rev}:{node|short} {desc}" | |||
|
35 | @ 5:df21b32134ba Added d | |||
|
36 | | | |||
|
37 | o 4:849767420fd5 Added c | |||
|
38 | | | |||
|
39 | | o 1:29becc82797a Added b | |||
|
40 | |/ | |||
|
41 | o 0:18d04c59bb5d Added a | |||
|
42 | ||||
|
43 | $ hg rebase -s 1 -d 5 -q -T "{nodechanges|json}" | |||
|
44 | {"29becc82797a4bc11ec8880b58eaecd2ab3e7760": ["d9d6773efc831c274eace04bc13e8e6412517139"]} (no-eol) |
@@ -21,6 +21,7 b' import os' | |||||
21 |
|
21 | |||
22 | from mercurial.i18n import _ |
|
22 | from mercurial.i18n import _ | |
23 | from mercurial.node import ( |
|
23 | from mercurial.node import ( | |
|
24 | hex, | |||
24 | nullid, |
|
25 | nullid, | |
25 | nullrev, |
|
26 | nullrev, | |
26 | short, |
|
27 | short, | |
@@ -501,6 +502,8 b' class rebaseruntime(object):' | |||||
501 |
|
502 | |||
502 | def _finishrebase(self): |
|
503 | def _finishrebase(self): | |
503 | repo, ui, opts = self.repo, self.ui, self.opts |
|
504 | repo, ui, opts = self.repo, self.ui, self.opts | |
|
505 | fm = ui.formatter('rebase', opts) | |||
|
506 | fm.startitem() | |||
504 | if self.collapsef and not self.keepopen: |
|
507 | if self.collapsef and not self.keepopen: | |
505 | p1, p2, _base = defineparents(repo, min(self.state), self.destmap, |
|
508 | p1, p2, _base = defineparents(repo, min(self.state), self.destmap, | |
506 | self.state, self.skipped, |
|
509 | self.state, self.skipped, | |
@@ -551,7 +554,7 b' class rebaseruntime(object):' | |||||
551 | if self.collapsef: |
|
554 | if self.collapsef: | |
552 | collapsedas = newnode |
|
555 | collapsedas = newnode | |
553 | clearrebased(ui, repo, self.destmap, self.state, self.skipped, |
|
556 | clearrebased(ui, repo, self.destmap, self.state, self.skipped, | |
554 | collapsedas, self.keepf) |
|
557 | collapsedas, self.keepf, fm=fm) | |
555 |
|
558 | |||
556 | clearstatus(repo) |
|
559 | clearstatus(repo) | |
557 | clearcollapsemsg(repo) |
|
560 | clearcollapsemsg(repo) | |
@@ -561,6 +564,7 b' class rebaseruntime(object):' | |||||
561 | if self.skipped: |
|
564 | if self.skipped: | |
562 | skippedlen = len(self.skipped) |
|
565 | skippedlen = len(self.skipped) | |
563 | ui.note(_("%d revisions have been skipped\n") % skippedlen) |
|
566 | ui.note(_("%d revisions have been skipped\n") % skippedlen) | |
|
567 | fm.end() | |||
564 |
|
568 | |||
565 | if (self.activebookmark and self.activebookmark in repo._bookmarks and |
|
569 | if (self.activebookmark and self.activebookmark in repo._bookmarks and | |
566 | repo['.'].node() == repo._bookmarks[self.activebookmark]): |
|
570 | repo['.'].node() == repo._bookmarks[self.activebookmark]): | |
@@ -1517,7 +1521,7 b' def buildstate(repo, destmap, collapse):' | |||||
1517 | return originalwd, destmap, state |
|
1521 | return originalwd, destmap, state | |
1518 |
|
1522 | |||
1519 | def clearrebased(ui, repo, destmap, state, skipped, collapsedas=None, |
|
1523 | def clearrebased(ui, repo, destmap, state, skipped, collapsedas=None, | |
1520 | keepf=False): |
|
1524 | keepf=False, fm=None): | |
1521 | """dispose of rebased revision at the end of the rebase |
|
1525 | """dispose of rebased revision at the end of the rebase | |
1522 |
|
1526 | |||
1523 | If `collapsedas` is not None, the rebase was a collapse whose result if the |
|
1527 | If `collapsedas` is not None, the rebase was a collapse whose result if the | |
@@ -1541,6 +1545,10 b' def clearrebased(ui, repo, destmap, stat' | |||||
1541 | succs = (newnode,) |
|
1545 | succs = (newnode,) | |
1542 | replacements[oldnode] = succs |
|
1546 | replacements[oldnode] = succs | |
1543 | scmutil.cleanupnodes(repo, replacements, 'rebase', moves) |
|
1547 | scmutil.cleanupnodes(repo, replacements, 'rebase', moves) | |
|
1548 | if fm: | |||
|
1549 | nodechanges = {hex(oldn): [hex(n) for n in newn] | |||
|
1550 | for oldn, newn in replacements.iteritems()} | |||
|
1551 | fm.data(nodechanges=nodechanges) | |||
1544 |
|
1552 | |||
1545 | def pullrebase(orig, ui, repo, *args, **opts): |
|
1553 | def pullrebase(orig, ui, repo, *args, **opts): | |
1546 | 'Call rebase after pull if the latter has been invoked with --rebase' |
|
1554 | 'Call rebase after pull if the latter has been invoked with --rebase' |
General Comments 0
You need to be logged in to leave comments.
Login now