Mercurial > hg
comparison tests/test-rebase-templates.t @ 34883:c858afe9c59b
rebase: add support to output nodechanges
This patch adds support to rebase to show the changes in node once the rebase is
complete. This will be extremely helpful for automation purposes and editors
such as Nuclide.
The output is a dictionary of predecessor hash as key and a list of successors'
hashes. The successors one is a list as there can be many successors for a single
predecessor in case of split and it will good to have a generic output format.
This patch adds tests for the same. A new file is created for the patch as
existing files related to rebase has their own purpose and there will be more
formatter support coming for rebase in next cycle.
Thanks to Jun for suggesting to use fm.data().
Differential Revision: https://phab.mercurial-scm.org/D1173
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Wed, 18 Oct 2017 04:31:46 +0530 |
parents | |
children | c157bb0120a9 |
comparison
equal
deleted
inserted
replaced
34882:e9f320a40b44 | 34883:c858afe9c59b |
---|---|
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) |