Show More
@@ -0,0 +1,51 b'' | |||||
|
1 | echo "[extensions]" >> $HGRCPATH | |||
|
2 | echo "mq=" >> $HGRCPATH | |||
|
3 | ||||
|
4 | teststrip() { | |||
|
5 | hg up -C $1 | |||
|
6 | echo % before update $1, strip $2 | |||
|
7 | hg parents | |||
|
8 | hg strip $2 2>&1 | sed 's/\(saving bundle to \).*/\1/' | |||
|
9 | echo % after update $1, strip $2 | |||
|
10 | hg parents | |||
|
11 | hg unbundle -q .hg/strip-backup/* | |||
|
12 | rm .hg/strip-backup/* | |||
|
13 | } | |||
|
14 | ||||
|
15 | hg init test | |||
|
16 | cd test | |||
|
17 | ||||
|
18 | echo foo > bar | |||
|
19 | hg ci -Ama | |||
|
20 | ||||
|
21 | echo more >> bar | |||
|
22 | hg ci -Amb | |||
|
23 | ||||
|
24 | echo blah >> bar | |||
|
25 | hg ci -Amc | |||
|
26 | ||||
|
27 | hg up 1 | |||
|
28 | echo blah >> bar | |||
|
29 | hg ci -Amd | |||
|
30 | ||||
|
31 | echo final >> bar | |||
|
32 | hg ci -Ame | |||
|
33 | ||||
|
34 | hg log | |||
|
35 | ||||
|
36 | teststrip 4 4 | |||
|
37 | teststrip 4 3 | |||
|
38 | teststrip 1 4 | |||
|
39 | teststrip 4 2 | |||
|
40 | teststrip 4 1 | |||
|
41 | teststrip null 4 | |||
|
42 | ||||
|
43 | hg log | |||
|
44 | ||||
|
45 | hg up -C 2 | |||
|
46 | hg merge 4 | |||
|
47 | echo % before strip of merge parent | |||
|
48 | hg parents | |||
|
49 | hg strip 4 2>&1 | sed 's/\(saving bundle to \).*/\1/' | |||
|
50 | echo % after strip of merge parent | |||
|
51 | hg parents |
@@ -0,0 +1,173 b'' | |||||
|
1 | adding bar | |||
|
2 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
3 | created new head | |||
|
4 | changeset: 4:443431ffac4f | |||
|
5 | tag: tip | |||
|
6 | user: test | |||
|
7 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
8 | summary: e | |||
|
9 | ||||
|
10 | changeset: 3:65bd5f99a4a3 | |||
|
11 | parent: 1:ef3a871183d7 | |||
|
12 | user: test | |||
|
13 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
14 | summary: d | |||
|
15 | ||||
|
16 | changeset: 2:264128213d29 | |||
|
17 | user: test | |||
|
18 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
19 | summary: c | |||
|
20 | ||||
|
21 | changeset: 1:ef3a871183d7 | |||
|
22 | user: test | |||
|
23 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
24 | summary: b | |||
|
25 | ||||
|
26 | changeset: 0:9ab35a2d17cb | |||
|
27 | user: test | |||
|
28 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
29 | summary: a | |||
|
30 | ||||
|
31 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
32 | % before update 4, strip 4 | |||
|
33 | changeset: 4:443431ffac4f | |||
|
34 | tag: tip | |||
|
35 | user: test | |||
|
36 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
37 | summary: e | |||
|
38 | ||||
|
39 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
40 | saving bundle to | |||
|
41 | % after update 4, strip 4 | |||
|
42 | changeset: 3:65bd5f99a4a3 | |||
|
43 | tag: tip | |||
|
44 | parent: 1:ef3a871183d7 | |||
|
45 | user: test | |||
|
46 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
47 | summary: d | |||
|
48 | ||||
|
49 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
50 | % before update 4, strip 3 | |||
|
51 | changeset: 4:443431ffac4f | |||
|
52 | tag: tip | |||
|
53 | user: test | |||
|
54 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
55 | summary: e | |||
|
56 | ||||
|
57 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
58 | saving bundle to | |||
|
59 | % after update 4, strip 3 | |||
|
60 | changeset: 1:ef3a871183d7 | |||
|
61 | user: test | |||
|
62 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
63 | summary: b | |||
|
64 | ||||
|
65 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
66 | % before update 1, strip 4 | |||
|
67 | changeset: 1:ef3a871183d7 | |||
|
68 | user: test | |||
|
69 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
70 | summary: b | |||
|
71 | ||||
|
72 | saving bundle to | |||
|
73 | % after update 1, strip 4 | |||
|
74 | changeset: 1:ef3a871183d7 | |||
|
75 | user: test | |||
|
76 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
77 | summary: b | |||
|
78 | ||||
|
79 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
80 | % before update 4, strip 2 | |||
|
81 | changeset: 4:443431ffac4f | |||
|
82 | tag: tip | |||
|
83 | user: test | |||
|
84 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
85 | summary: e | |||
|
86 | ||||
|
87 | saving bundle to | |||
|
88 | saving bundle to | |||
|
89 | adding branch | |||
|
90 | adding changesets | |||
|
91 | adding manifests | |||
|
92 | adding file changes | |||
|
93 | added 2 changesets with 2 changes to 1 files | |||
|
94 | % after update 4, strip 2 | |||
|
95 | changeset: 3:443431ffac4f | |||
|
96 | tag: tip | |||
|
97 | user: test | |||
|
98 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
99 | summary: e | |||
|
100 | ||||
|
101 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
102 | % before update 4, strip 1 | |||
|
103 | changeset: 4:264128213d29 | |||
|
104 | tag: tip | |||
|
105 | parent: 1:ef3a871183d7 | |||
|
106 | user: test | |||
|
107 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
108 | summary: c | |||
|
109 | ||||
|
110 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
111 | saving bundle to | |||
|
112 | % after update 4, strip 1 | |||
|
113 | changeset: 0:9ab35a2d17cb | |||
|
114 | tag: tip | |||
|
115 | user: test | |||
|
116 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
117 | summary: a | |||
|
118 | ||||
|
119 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
120 | % before update null, strip 4 | |||
|
121 | saving bundle to | |||
|
122 | % after update null, strip 4 | |||
|
123 | changeset: 4:264128213d29 | |||
|
124 | tag: tip | |||
|
125 | parent: 1:ef3a871183d7 | |||
|
126 | user: test | |||
|
127 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
128 | summary: c | |||
|
129 | ||||
|
130 | changeset: 3:443431ffac4f | |||
|
131 | user: test | |||
|
132 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
133 | summary: e | |||
|
134 | ||||
|
135 | changeset: 2:65bd5f99a4a3 | |||
|
136 | user: test | |||
|
137 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
138 | summary: d | |||
|
139 | ||||
|
140 | changeset: 1:ef3a871183d7 | |||
|
141 | user: test | |||
|
142 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
143 | summary: b | |||
|
144 | ||||
|
145 | changeset: 0:9ab35a2d17cb | |||
|
146 | user: test | |||
|
147 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
148 | summary: a | |||
|
149 | ||||
|
150 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
151 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
152 | (branch merge, don't forget to commit) | |||
|
153 | % before strip of merge parent | |||
|
154 | changeset: 2:65bd5f99a4a3 | |||
|
155 | user: test | |||
|
156 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
157 | summary: d | |||
|
158 | ||||
|
159 | changeset: 4:264128213d29 | |||
|
160 | tag: tip | |||
|
161 | parent: 1:ef3a871183d7 | |||
|
162 | user: test | |||
|
163 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
164 | summary: c | |||
|
165 | ||||
|
166 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
167 | saving bundle to | |||
|
168 | % after strip of merge parent | |||
|
169 | changeset: 1:ef3a871183d7 | |||
|
170 | user: test | |||
|
171 | date: Thu Jan 01 00:00:00 1970 +0000 | |||
|
172 | summary: b | |||
|
173 |
@@ -2060,14 +2060,28 b' def save(ui, repo, **opts):' | |||||
2060 | return 0 |
|
2060 | return 0 | |
2061 |
|
2061 | |||
2062 | def strip(ui, repo, rev, **opts): |
|
2062 | def strip(ui, repo, rev, **opts): | |
2063 |
"""strip a revision and all |
|
2063 | """strip a revision and all its descendants from the repository | |
2064 | rev = repo.lookup(rev) |
|
2064 | ||
|
2065 | If one of the working dir's parent revisions is stripped, the working | |||
|
2066 | directory will be updated to the parent of the stripped revision. | |||
|
2067 | """ | |||
2065 | backup = 'all' |
|
2068 | backup = 'all' | |
2066 | if opts['backup']: |
|
2069 | if opts['backup']: | |
2067 | backup = 'strip' |
|
2070 | backup = 'strip' | |
2068 | elif opts['nobackup']: |
|
2071 | elif opts['nobackup']: | |
2069 | backup = 'none' |
|
2072 | backup = 'none' | |
2070 | update = repo.dirstate.parents()[0] != revlog.nullid |
|
2073 | ||
|
2074 | rev = repo.lookup(rev) | |||
|
2075 | p = repo.dirstate.parents() | |||
|
2076 | cl = repo.changelog | |||
|
2077 | update = True | |||
|
2078 | if p[0] == revlog.nullid: | |||
|
2079 | update = False | |||
|
2080 | elif p[1] == revlog.nullid and rev != cl.ancestor(p[0], rev): | |||
|
2081 | update = False | |||
|
2082 | elif rev not in (cl.ancestor(p[0], rev), cl.ancestor(p[1], rev)): | |||
|
2083 | update = False | |||
|
2084 | ||||
2071 | repo.mq.strip(repo, rev, backup=backup, update=update) |
|
2085 | repo.mq.strip(repo, rev, backup=backup, update=update) | |
2072 | return 0 |
|
2086 | return 0 | |
2073 |
|
2087 |
@@ -48,7 +48,7 b' list of commands:' | |||||
48 | qseries print the entire series file |
|
48 | qseries print the entire series file | |
49 | qtop print the name of the current patch |
|
49 | qtop print the name of the current patch | |
50 | qunapplied print the patches not yet applied |
|
50 | qunapplied print the patches not yet applied | |
51 |
strip strip a revision and all |
|
51 | strip strip a revision and all its descendants from the repository | |
52 |
|
52 | |||
53 | use "hg -v help mq" to show aliases and global options |
|
53 | use "hg -v help mq" to show aliases and global options | |
54 | adding a |
|
54 | adding a |
General Comments 0
You need to be logged in to leave comments.
Login now