Debian Codegraph @

tests/test-rebase-templates.t

raw
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)
45
46 $ hg log -G -T "{rev}:{node|short} {desc}"
47 o 6:d9d6773efc83 Added b
48 |
49 @ 5:df21b32134ba Added d
50 |
51 o 4:849767420fd5 Added c
52 |
53 o 0:18d04c59bb5d Added a
54
55
56 $ hg rebase -s 6 -d 4 -q -T "{nodechanges % '{oldnode}:{newnodes % ' {node} '}'}"
57 d9d6773efc831c274eace04bc13e8e6412517139: f48cd65c6dc3d2acb55da54402a5b029546e546f (no-eol)
58
59 $ hg log -G -T "{rev}:{node|short} {desc}"
60 o 7:f48cd65c6dc3 Added b
61 |
62 | @ 5:df21b32134ba Added d
63 |/
64 o 4:849767420fd5 Added c
65 |
66 o 0:18d04c59bb5d Added a
67
68
69
70 $ hg rebase -s 7 -d 5 -q --keep -T "{nodechanges % '{oldnode}:{newnodes % ' {node} '}'}"
71 f48cd65c6dc3d2acb55da54402a5b029546e546f: 6f7dda91e55e728fb798f3e44dbecf0ebaa83267 (no-eol)
72
73 $ hg log -G -T "{rev}:{node|short} {desc}"
74 o 8:6f7dda91e55e Added b
75 |
76 | o 7:f48cd65c6dc3 Added b
77 | |
78 @ | 5:df21b32134ba Added d
79 |/
80 o 4:849767420fd5 Added c
81 |
82 o 0:18d04c59bb5d Added a
83
84
85 Respects command-templates.oneline-summary
86
87 $ hg rebase -r 7 -d 8 -n --config command-templates.oneline-summary='rev: {rev}'
88 starting dry-run rebase; repository will not be changed
89 rebasing rev: 7
90 note: not rebasing rev: 7, its destination already has all its changes
91 dry-run rebase completed successfully; run without -n/--dry-run to perform this rebase
92
93
94 command-templates.oneline-summary.rebase overrides
95
96 $ hg rebase -r 7 -d 8 -n \
97 > --config command-templates.oneline-summary='global: {rev}' \
98 > --config command-templates.oneline-summary.rebase='override: {rev}'
99 starting dry-run rebase; repository will not be changed
100 rebasing override: 7
101 note: not rebasing override: 7, its destination already has all its changes
102 dry-run rebase completed successfully; run without -n/--dry-run to perform this rebase
103
104
105 check namespaces and coloring (labels)
106
107 $ hg tag -l -r 7 my-tag
108 $ hg rebase -r 7 -d 8 -n
109 starting dry-run rebase; repository will not be changed
110 rebasing 7:f48cd65c6dc3 my-tag "Added b"
111 note: not rebasing 7:f48cd65c6dc3 my-tag "Added b", its destination already has all its changes
112 dry-run rebase completed successfully; run without -n/--dry-run to perform this rebase
113 $ hg bookmark -r 7 my-bookmark
114 $ hg rebase -r 7 -d 8 -n
115 starting dry-run rebase; repository will not be changed
116 rebasing 7:f48cd65c6dc3 my-bookmark my-tag "Added b"
117 note: not rebasing 7:f48cd65c6dc3 my-bookmark my-tag "Added b", its destination already has all its changes
118 dry-run rebase completed successfully; run without -n/--dry-run to perform this rebase
119 $ hg rebase -r 7 -d 8 -n --color=debug
120 [ ui.status|starting dry-run rebase; repository will not be changed]
121 [ ui.status|rebasing [oneline-summary.changeset|7:f48cd65c6dc3] [oneline-summary.bookmarks|my-bookmark] [oneline-summary.tags|my-tag] "[oneline-summary.desc|Added b]"]
122 [ ui.warning|note: not rebasing [oneline-summary.changeset|7:f48cd65c6dc3] [oneline-summary.bookmarks|my-bookmark] [oneline-summary.tags|my-tag] "[oneline-summary.desc|Added b]", its destination already has all its changes]
123 [ ui.status|dry-run rebase completed successfully; run without -n/--dry-run to perform this rebase]