##// END OF EJS Templates
amend: update .hgsubstate before committing a memctx (issue5677)...
Yuya Nishihara -
r35019:691524f0 stable
parent child Browse files
Show More
@@ -3153,6 +3153,18 b' def amend(ui, repo, old, extra, pats, op'
3153 3153 raise error.Abort(
3154 3154 _("failed to mark all new/missing files as added/removed"))
3155 3155
3156 # Check subrepos. This depends on in-place wctx._status update in
3157 # subrepo.precommit(). To minimize the risk of this hack, we do
3158 # nothing if .hgsub does not exist.
3159 if '.hgsub' in wctx or '.hgsub' in old:
3160 from . import subrepo # avoid cycle: cmdutil -> subrepo -> cmdutil
3161 subs, commitsubs, newsubstate = subrepo.precommit(
3162 ui, wctx, wctx._status, matcher)
3163 # amend should abort if commitsubrepos is enabled
3164 assert not commitsubs
3165 if subs:
3166 subrepo.writestate(repo, newsubstate)
3167
3156 3168 filestoamend = set(f for f in wctx.files() if matcher(f))
3157 3169
3158 3170 changes = (len(filestoamend) > 0)
@@ -31,28 +31,18 b' Link first subrepo'
31 31
32 32 amend without .hgsub
33 33
34 BROKEN: should say "can't commit subrepos without .hgsub"
35 34 $ hg amend s
36 nothing changed
37 [1]
35 abort: can't commit subrepos without .hgsub
36 [255]
38 37
39 38 amend with subrepo
40 39
41 BROKEN: should update .hgsubstate
42 40 $ hg amend
43 41 saved backup bundle to * (glob) (obsstore-off !)
44 42 $ hg status --change .
45 43 A .hgsub
44 A .hgsubstate
46 45 A a
47
48 FIX UP .hgsubstate
49
50 $ hg ci -mfix
51 $ hg rollback -q
52 $ hg add .hgsubstate
53 $ hg amend
54 saved backup bundle to * (glob) (obsstore-off !)
55
56 46 $ cat .hgsubstate
57 47 0000000000000000000000000000000000000000 s
58 48
@@ -69,46 +59,27 b' amend with dirty subrepo'
69 59 $ echo a >> s/a
70 60 $ hg add -R s
71 61 adding s/a
72 BROKEN: should say "uncommitted changes in subrepository"
73 62 $ hg amend
74 nothing changed
75 [1]
63 abort: uncommitted changes in subrepository "s"
64 (use --subrepos for recursive commit)
65 [255]
76 66
77 67 amend with modified subrepo
78 68
79 69 $ hg ci -R s -m0
80 BROKEN: should update .hgsubstate
81 $ hg amend
82 nothing changed
83 [1]
84 $ hg status --change .
85 M a
86
87 FIX UP .hgsubstate
88
89 $ hg ci -mfix
90 $ hg rollback -q
91 70 $ hg amend
92 71 saved backup bundle to * (glob) (obsstore-off !)
93
72 $ hg status --change .
73 M .hgsubstate
74 M a
94 75 $ cat .hgsubstate
95 76 f7b1eb17ad24730a1651fccd46c43826d1bbc2ac s
96 77
97 78 revert subrepo change
98 79
99 80 $ hg up -R s -q null
100 BROKEN: should update .hgsubstate
101 $ hg amend
102 nothing changed
103 [1]
104
105 FIX UP .hgsubstate
106
107 $ hg ci -mfix
108 $ hg rollback -q
109 81 $ hg amend
110 82 saved backup bundle to * (glob) (obsstore-off !)
111
112 83 $ hg status --change .
113 84 M a
114 85
@@ -131,21 +102,13 b' amend with another subrepo'
131 102 $ hg ci -R t -Am0
132 103 adding b
133 104 $ echo 't = t' >> .hgsub
134 BROKEN: should update .hgsubstate
135 105 $ hg amend
136 106 saved backup bundle to * (glob) (obsstore-off !)
137 107 $ hg status --change .
138 108 M .hgsub
109 M .hgsubstate
139 110 M a
140 111 A b
141
142 FIX UP .hgsubstate
143
144 $ hg ci -mfix
145 $ hg rollback -q
146 $ hg amend
147 saved backup bundle to * (glob) (obsstore-off !)
148
149 112 $ cat .hgsubstate
150 113 0000000000000000000000000000000000000000 s
151 114 bfb1a4fb358498a9533dabf4f2043d94162f1fcd t
@@ -161,23 +124,12 b' add new commit to be amended'
161 124 amend with one subrepo dropped
162 125
163 126 $ echo 't = t' > .hgsub
164 BROKEN: should update .hgsubstate
165 127 $ hg amend
166 128 saved backup bundle to * (glob) (obsstore-off !)
167 129 $ hg status --change .
168 130 M .hgsub
131 M .hgsubstate
169 132 M a
170
171 FIX UP .hgsubstate
172
173 $ echo 's = s' > .hgsub
174 $ hg amend -q
175 $ echo 't = t' > .hgsub
176 $ hg ci -mfix
177 $ hg rollback -q
178 $ hg amend
179 saved backup bundle to * (glob) (obsstore-off !)
180
181 133 $ cat .hgsubstate
182 134 bfb1a4fb358498a9533dabf4f2043d94162f1fcd t
183 135
@@ -192,22 +144,11 b' add new commit to be amended'
192 144 amend with .hgsub removed
193 145
194 146 $ hg rm .hgsub
195 BROKEN: should update .hgsubstate
196 147 $ hg amend
197 148 saved backup bundle to * (glob) (obsstore-off !)
198 149 $ hg status --change .
199 150 M a
200 151 R .hgsub
201
202 FIX UP .hgsubstate
203
204 $ hg forget .hgsubstate
205 $ hg amend
206 saved backup bundle to * (glob) (obsstore-off !)
207
208 $ hg status --change .
209 M a
210 R .hgsub
211 152 R .hgsubstate
212 153
213 154 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now