##// END OF EJS Templates
histedit: sniff-test for untracked file conflicts before prompting for rules...
Augie Fackler -
r43247:699102b1 default
parent child Browse files
Show More
@@ -1970,6 +1970,32 b' def _newhistedit(ui, repo, state, revs, '
1970 node.short(root))
1970 node.short(root))
1971
1971
1972 ctxs = [repo[r] for r in revs]
1972 ctxs = [repo[r] for r in revs]
1973
1974 wctx = repo[None]
1975 # Please don't ask me why `ancestors` is this value. I figured it
1976 # out with print-debugging, not by actually understanding what the
1977 # merge code is doing. :(
1978 ancs = [repo['.']]
1979 # Sniff-test to make sure we won't collide with untracked files in
1980 # the working directory. If we don't do this, we can get a
1981 # collision after we've started histedit and backing out gets ugly
1982 # for everyone, especially the user.
1983 for c in [ctxs[0].p1()] + ctxs:
1984 try:
1985 mergemod.calculateupdates(
1986 repo, wctx, c, ancs,
1987 # These parameters were determined by print-debugging
1988 # what happens later on inside histedit.
1989 False, # branchmerge
1990 False, # force
1991 False, # acceptremote
1992 False, # followcopies
1993 )
1994 except error.Abort:
1995 raise error.Abort(
1996 _("untracked files in working directory conflict with files in %s") % (
1997 c))
1998
1973 if not rules:
1999 if not rules:
1974 comment = geteditcomment(ui, node.short(root), node.short(topmost))
2000 comment = geteditcomment(ui, node.short(root), node.short(topmost))
1975 actions = [pick(state, r) for r in revs]
2001 actions = [pick(state, r) for r in revs]
@@ -162,55 +162,26 b' log after abort'
162 summary: a
162 summary: a
163
163
164
164
165 Early tree conflict doesn't leave histedit in a wedged state.
165 Early tree conflict doesn't leave histedit in a wedged state. Note
166 that we don't specify --commands here: we catch the problem before we
167 even prompt the user for rules, sidestepping any dataloss issues.
168
166 $ hg rm c
169 $ hg rm c
167 $ hg ci -m 'remove c'
170 $ hg ci -m 'remove c'
168 $ echo collision > c
171 $ echo collision > c
169
172
170 $ hg histedit e860deea161a --commands - 2>&1 <<EOF
173 $ hg histedit e860deea161a
171 > edit e860deea161a
172 > pick 652413bf663e
173 > pick bfa474341cc9
174 > pick 1b0954ff00fc
175 > EOF
176 c: untracked file differs
174 c: untracked file differs
177 abort: untracked files in working directory differ from files in requested revision
175 abort: untracked files in working directory conflict with files in 055a42cdd887
178 [255]
176 [255]
179
177
180 BUG: we didn't actually change p1 of the working copy, but we're in a
178 We should have detected the collision early enough we're not in a
181 histedit state. This confuses the process very badly and leads to
179 histedit state, and p1 is unchanged.
182 histedit stripping things it shouldn't (in obsmarker mode it inserts
183 bogus prune markers in this case.)
184
180
185 $ hg log -r 'p1()' -T'{node}\n'
181 $ hg log -r 'p1()' -T'{node}\n'
186 1b0954ff00fccb15a37b679e4a35e9b01dfe685e
182 1b0954ff00fccb15a37b679e4a35e9b01dfe685e
187 $ hg status --config ui.tweakdefaults=yes
183 $ hg status --config ui.tweakdefaults=yes
188 ? c
184 ? c
189 ? e.orig
185 ? e.orig
190 # The repository is in an unfinished *histedit* state.
191
192 # To continue: hg histedit --continue
193 # To abort: hg histedit --abort
194
195 $ hg histedit --continue
196 652413bf663e: skipping changeset (no changes)
197 bfa474341cc9: skipping changeset (no changes)
198 1b0954ff00fc: skipping changeset (no changes)
199 saved backup bundle to $TESTTMP/r/.hg/strip-backup/e860deea161a-a0738322-histedit.hg
200
201 $ hg log -GTcompact
202 warning: ignoring unknown working parent 1b0954ff00fc!
203 o 3[tip] 055a42cdd887 1970-01-01 00:00 +0000 test
204 | d
205 |
206 o 2 177f92b77385 1970-01-01 00:00 +0000 test
207 | c
208 |
209 o 1 d2ae7f538514 1970-01-01 00:00 +0000 test
210 | b
211 |
212 o 0 cb9a9f314b8b 1970-01-01 00:00 +0000 test
213 a
214
215
186
216 $ cd ..
187 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now