Show More
@@ -0,0 +1,175 b'' | |||||
|
1 | ========================== | |||
|
2 | Test rebase with obsolete | |||
|
3 | ========================== | |||
|
4 | ||||
|
5 | Enable obsolete | |||
|
6 | ||||
|
7 | $ cat > ${TESTTMP}/obs.py << EOF | |||
|
8 | > import mercurial.obsolete | |||
|
9 | > mercurial.obsolete._enabled = True | |||
|
10 | > EOF | |||
|
11 | $ cat >> $HGRCPATH << EOF | |||
|
12 | > [ui] | |||
|
13 | > logtemplate= {rev}:{node|short} {desc|firstline} | |||
|
14 | > [phases] | |||
|
15 | > publish=False | |||
|
16 | > [extensions]' | |||
|
17 | > rebase= | |||
|
18 | > | |||
|
19 | > obs=${TESTTMP}/obs.py | |||
|
20 | > EOF | |||
|
21 | ||||
|
22 | Setup rebase canonical repo | |||
|
23 | ||||
|
24 | $ hg init base | |||
|
25 | $ cd base | |||
|
26 | $ hg unbundle "$TESTDIR/bundles/rebase.hg" | |||
|
27 | adding changesets | |||
|
28 | adding manifests | |||
|
29 | adding file changes | |||
|
30 | added 8 changesets with 7 changes to 7 files (+2 heads) | |||
|
31 | (run 'hg heads' to see heads, 'hg merge' to merge) | |||
|
32 | $ hg up tip | |||
|
33 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
34 | $ hg log -G | |||
|
35 | @ 7:02de42196ebe H | |||
|
36 | | | |||
|
37 | | o 6:eea13746799a G | |||
|
38 | |/| | |||
|
39 | o | 5:24b6387c8c8c F | |||
|
40 | | | | |||
|
41 | | o 4:9520eea781bc E | |||
|
42 | |/ | |||
|
43 | | o 3:32af7686d403 D | |||
|
44 | | | | |||
|
45 | | o 2:5fddd98957c8 C | |||
|
46 | | | | |||
|
47 | | o 1:42ccdea3bb16 B | |||
|
48 | |/ | |||
|
49 | o 0:cd010b8cd998 A | |||
|
50 | ||||
|
51 | $ cd .. | |||
|
52 | ||||
|
53 | simple rebase | |||
|
54 | --------------------------------- | |||
|
55 | ||||
|
56 | $ hg clone base simple | |||
|
57 | updating to branch default | |||
|
58 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
59 | $ cd simple | |||
|
60 | $ hg up 32af7686d403 | |||
|
61 | 3 files updated, 0 files merged, 2 files removed, 0 files unresolved | |||
|
62 | $ hg rebase -d eea13746799a | |||
|
63 | $ hg log -G | |||
|
64 | @ 10:8eeb3c33ad33 D | |||
|
65 | | | |||
|
66 | o 9:2327fea05063 C | |||
|
67 | | | |||
|
68 | o 8:e4e5be0395b2 B | |||
|
69 | | | |||
|
70 | | o 7:02de42196ebe H | |||
|
71 | | | | |||
|
72 | o | 6:eea13746799a G | |||
|
73 | |\| | |||
|
74 | | o 5:24b6387c8c8c F | |||
|
75 | | | | |||
|
76 | o | 4:9520eea781bc E | |||
|
77 | |/ | |||
|
78 | o 0:cd010b8cd998 A | |||
|
79 | ||||
|
80 | $ hg log --hidden -G | |||
|
81 | @ 10:8eeb3c33ad33 D | |||
|
82 | | | |||
|
83 | o 9:2327fea05063 C | |||
|
84 | | | |||
|
85 | o 8:e4e5be0395b2 B | |||
|
86 | | | |||
|
87 | | o 7:02de42196ebe H | |||
|
88 | | | | |||
|
89 | o | 6:eea13746799a G | |||
|
90 | |\| | |||
|
91 | | o 5:24b6387c8c8c F | |||
|
92 | | | | |||
|
93 | o | 4:9520eea781bc E | |||
|
94 | |/ | |||
|
95 | | x 3:32af7686d403 D | |||
|
96 | | | | |||
|
97 | | x 2:5fddd98957c8 C | |||
|
98 | | | | |||
|
99 | | x 1:42ccdea3bb16 B | |||
|
100 | |/ | |||
|
101 | o 0:cd010b8cd998 A | |||
|
102 | ||||
|
103 | $ hg debugobsolete | |||
|
104 | 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 e4e5be0395b2cbd471ed22a26b1b6a1a0658a794 0 {'date': '*', 'user': 'test'} (glob) | |||
|
105 | 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 2327fea05063f39961b14cb69435a9898dc9a245 0 {'date': '*', 'user': 'test'} (glob) | |||
|
106 | 32af7686d403cf45b5d95f2d70cebea587ac806a 8eeb3c33ad33d452c89e5dcf611c347f978fb42b 0 {'date': '*', 'user': 'test'} (glob) | |||
|
107 | ||||
|
108 | ||||
|
109 | $ cd .. | |||
|
110 | ||||
|
111 | empty changeset | |||
|
112 | --------------------------------- | |||
|
113 | ||||
|
114 | $ hg clone base empty | |||
|
115 | updating to branch default | |||
|
116 | 3 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
117 | $ cd empty | |||
|
118 | $ hg up eea13746799a | |||
|
119 | 1 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
120 | ||||
|
121 | We make a copy of both the first changeset in the rebased and some other in the | |||
|
122 | set. | |||
|
123 | ||||
|
124 | $ hg graft 42ccdea3bb16 32af7686d403 | |||
|
125 | grafting revision 1 | |||
|
126 | grafting revision 3 | |||
|
127 | $ hg rebase -s 42ccdea3bb16 -d . | |||
|
128 | $ hg log -G | |||
|
129 | @ 10:5ae4c968c6ac C | |||
|
130 | | | |||
|
131 | o 9:08483444fef9 D | |||
|
132 | | | |||
|
133 | o 8:8877864f1edb B | |||
|
134 | | | |||
|
135 | | o 7:02de42196ebe H | |||
|
136 | | | | |||
|
137 | o | 6:eea13746799a G | |||
|
138 | |\| | |||
|
139 | | o 5:24b6387c8c8c F | |||
|
140 | | | | |||
|
141 | o | 4:9520eea781bc E | |||
|
142 | |/ | |||
|
143 | o 0:cd010b8cd998 A | |||
|
144 | ||||
|
145 | $ hg log --hidden -G | |||
|
146 | @ 10:5ae4c968c6ac C | |||
|
147 | | | |||
|
148 | o 9:08483444fef9 D | |||
|
149 | | | |||
|
150 | o 8:8877864f1edb B | |||
|
151 | | | |||
|
152 | | o 7:02de42196ebe H | |||
|
153 | | | | |||
|
154 | o | 6:eea13746799a G | |||
|
155 | |\| | |||
|
156 | | o 5:24b6387c8c8c F | |||
|
157 | | | | |||
|
158 | o | 4:9520eea781bc E | |||
|
159 | |/ | |||
|
160 | | x 3:32af7686d403 D | |||
|
161 | | | | |||
|
162 | | x 2:5fddd98957c8 C | |||
|
163 | | | | |||
|
164 | | x 1:42ccdea3bb16 B | |||
|
165 | |/ | |||
|
166 | o 0:cd010b8cd998 A | |||
|
167 | ||||
|
168 | $ hg debugobsolete | |||
|
169 | 42ccdea3bb16d28e1848c95fe2e44c000f3f21b1 08483444fef91d6224f6655ee586a65d263ad34c 0 {'date': '*', 'user': 'test'} (glob) | |||
|
170 | 5fddd98957c8a54a4d436dfe1da9d87f21a1b97b 5ae4c968c6aca831df823664e706c9d4aa34473d 0 {'date': '*', 'user': 'test'} (glob) | |||
|
171 | 32af7686d403cf45b5d95f2d70cebea587ac806a 5ae4c968c6aca831df823664e706c9d4aa34473d 0 {'date': '*', 'user': 'test'} (glob) | |||
|
172 | ||||
|
173 | ||||
|
174 | $ cd .. | |||
|
175 |
@@ -15,7 +15,7 b' http://mercurial.selenic.com/wiki/Rebase' | |||||
15 | ''' |
|
15 | ''' | |
16 |
|
16 | |||
17 | from mercurial import hg, util, repair, merge, cmdutil, commands, bookmarks |
|
17 | from mercurial import hg, util, repair, merge, cmdutil, commands, bookmarks | |
18 | from mercurial import extensions, patch, scmutil, phases |
|
18 | from mercurial import extensions, patch, scmutil, phases, obsolete | |
19 | from mercurial.commands import templateopts |
|
19 | from mercurial.commands import templateopts | |
20 | from mercurial.node import nullrev |
|
20 | from mercurial.node import nullrev | |
21 | from mercurial.lock import release |
|
21 | from mercurial.lock import release | |
@@ -658,14 +658,22 b' def buildstate(repo, dest, rebaseset, co' | |||||
658 |
|
658 | |||
659 | def clearrebased(ui, repo, state): |
|
659 | def clearrebased(ui, repo, state): | |
660 | """dispose of rebased revision at the end of the rebase""" |
|
660 | """dispose of rebased revision at the end of the rebase""" | |
661 | rebased = [rev for rev in state if state[rev] != nullmerge] |
|
661 | if obsolete._enabled: | |
662 | if rebased: |
|
662 | markers = [] | |
663 | if set(repo.changelog.descendants([min(rebased)])) - set(state): |
|
663 | for rev, newrev in sorted(state.items()): | |
664 | ui.warn(_("warning: new changesets detected " |
|
664 | if newrev >= 0: | |
665 | "on source branch, not stripping\n")) |
|
665 | markers.append((repo[rev], (repo[newrev],))) | |
666 |
|
|
666 | if markers: | |
667 | # backup the old csets by default |
|
667 | obsolete.createmarkers(repo, markers) | |
668 | repair.strip(ui, repo, repo[min(rebased)].node(), "all") |
|
668 | else: | |
|
669 | rebased = [rev for rev in state if state[rev] != nullmerge] | |||
|
670 | if rebased: | |||
|
671 | if set(repo.changelog.descendants([min(rebased)])) - set(state): | |||
|
672 | ui.warn(_("warning: new changesets detected " | |||
|
673 | "on source branch, not stripping\n")) | |||
|
674 | else: | |||
|
675 | # backup the old csets by default | |||
|
676 | repair.strip(ui, repo, repo[min(rebased)].node(), "all") | |||
669 |
|
677 | |||
670 |
|
678 | |||
671 | def pullrebase(orig, ui, repo, *args, **opts): |
|
679 | def pullrebase(orig, ui, repo, *args, **opts): |
General Comments 0
You need to be logged in to leave comments.
Login now