##// END OF EJS Templates
rebase: allow for rebasing descendants onto ancestors on different named branches...
Stefano Tortarolo -
r13733:4e2690a7 default
parent child Browse files
Show More
@@ -0,0 +1,171 b''
1 $ cat >> $HGRCPATH <<EOF
2 > [extensions]
3 > graphlog=
4 > rebase=
5 >
6 > [alias]
7 > tglog = log -G --template "{rev}: '{desc}' {branches}\n"
8 > EOF
9
10
11 $ hg init a
12 $ cd a
13
14 $ echo A > A
15 $ hg ci -Am A
16 adding A
17
18 $ echo B > B
19 $ hg ci -Am B
20 adding B
21
22 $ hg up -q -C 0
23
24 $ echo C > C
25 $ hg ci -Am C
26 adding C
27 created new head
28
29 $ hg up -q -C 0
30
31 $ echo D > D
32 $ hg ci -Am D
33 adding D
34 created new head
35
36 $ hg merge -r 2
37 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
38 (branch merge, don't forget to commit)
39
40 $ hg ci -m E
41
42 $ hg up -q -C 3
43
44 $ echo F > F
45 $ hg ci -Am F
46 adding F
47 created new head
48
49 $ cd ..
50
51
52 Rebasing descendant onto ancestor across different named branches
53
54 $ hg clone -q -u . a a1
55
56 $ cd a1
57
58 $ hg branch dev
59 marked working directory as branch dev
60
61 $ echo x > x
62
63 $ hg add x
64
65 $ hg ci -m 'extra named branch'
66
67 $ hg tglog
68 @ 6: 'extra named branch' dev
69 |
70 o 5: 'F'
71 |
72 | o 4: 'E'
73 |/|
74 o | 3: 'D'
75 | |
76 | o 2: 'C'
77 |/
78 | o 1: 'B'
79 |/
80 o 0: 'A'
81
82 $ hg rebase -s 6 -d 5
83 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/*-backup.hg (glob)
84
85 $ hg tglog
86 @ 6: 'extra named branch'
87 |
88 o 5: 'F'
89 |
90 | o 4: 'E'
91 |/|
92 o | 3: 'D'
93 | |
94 | o 2: 'C'
95 |/
96 | o 1: 'B'
97 |/
98 o 0: 'A'
99
100 $ cd ..
101
102 Rebasing descendant onto ancestor across the same named branches
103
104 $ hg clone -q -u . a a2
105
106 $ cd a2
107
108 $ echo x > x
109
110 $ hg add x
111
112 $ hg ci -m 'G'
113
114 $ hg tglog
115 @ 6: 'G'
116 |
117 o 5: 'F'
118 |
119 | o 4: 'E'
120 |/|
121 o | 3: 'D'
122 | |
123 | o 2: 'C'
124 |/
125 | o 1: 'B'
126 |/
127 o 0: 'A'
128
129 $ hg rebase -s 6 -d 5
130 abort: source is descendant of destination
131 [255]
132
133 $ cd ..
134
135 Rebasing ancestor onto descendant across different named branches
136
137 $ hg clone -q -u . a a3
138
139 $ cd a3
140
141 $ hg branch dev
142 marked working directory as branch dev
143
144 $ echo x > x
145
146 $ hg add x
147
148 $ hg ci -m 'extra named branch'
149
150 $ hg tglog
151 @ 6: 'extra named branch' dev
152 |
153 o 5: 'F'
154 |
155 | o 4: 'E'
156 |/|
157 o | 3: 'D'
158 | |
159 | o 2: 'C'
160 |/
161 | o 1: 'B'
162 |/
163 o 0: 'A'
164
165 $ hg rebase -s 5 -d 6
166 abort: source is ancestor of destination
167 [255]
168
169 $ cd ..
170
171
@@ -482,9 +482,10 b' def buildstate(repo, dest, src, base, de'
482
482
483 if src:
483 if src:
484 commonbase = repo[src].ancestor(repo[dest])
484 commonbase = repo[src].ancestor(repo[dest])
485 samebranch = repo[src].branch() == repo[dest].branch()
485 if commonbase == repo[src]:
486 if commonbase == repo[src]:
486 raise util.Abort(_('source is ancestor of destination'))
487 raise util.Abort(_('source is ancestor of destination'))
487 if commonbase == repo[dest]:
488 if samebranch and commonbase == repo[dest]:
488 raise util.Abort(_('source is descendant of destination'))
489 raise util.Abort(_('source is descendant of destination'))
489 source = repo[src].rev()
490 source = repo[src].rev()
490 if detach:
491 if detach:
General Comments 0
You need to be logged in to leave comments. Login now