##// END OF EJS Templates
update: allow setting default update check to "noconflict"...
Martin von Zweigbergk -
r31168:41a9edc5 default
parent child Browse files
Show More
@@ -743,12 +743,13 b' def updatetotally(ui, repo, checkout, br'
743 * none: don't check (merge working directory changes into destination)
743 * none: don't check (merge working directory changes into destination)
744 * linear: check that update is linear before merging working directory
744 * linear: check that update is linear before merging working directory
745 changes into destination
745 changes into destination
746 * noconflict: check that the update does not result in file merges
746
747
747 This returns whether conflict is detected at updating or not.
748 This returns whether conflict is detected at updating or not.
748 """
749 """
749 if updatecheck is None:
750 if updatecheck is None:
750 updatecheck = ui.config('experimental', 'updatecheck')
751 updatecheck = ui.config('experimental', 'updatecheck')
751 if updatecheck not in ('abort', 'none', 'linear'):
752 if updatecheck not in ('abort', 'none', 'linear', 'noconflict'):
752 # If not configured, or invalid value configured
753 # If not configured, or invalid value configured
753 updatecheck = 'linear'
754 updatecheck = 'linear'
754 with repo.wlock():
755 with repo.wlock():
@@ -1465,21 +1465,27 b' def update(repo, node, branchmerge, forc'
1465 The table below shows all the behaviors of the update command
1465 The table below shows all the behaviors of the update command
1466 given the -c and -C or no options, whether the working directory
1466 given the -c and -C or no options, whether the working directory
1467 is dirty, whether a revision is specified, and the relationship of
1467 is dirty, whether a revision is specified, and the relationship of
1468 the parent rev to the target rev (linear or not). Match from top first.
1468 the parent rev to the target rev (linear or not). Match from top first. The
1469 -n option doesn't exist on the command line, but represents the
1470 experimental.updatecheck=noconflict option.
1469
1471
1470 This logic is tested by test-update-branches.t.
1472 This logic is tested by test-update-branches.t.
1471
1473
1472 -c -C -m dirty rev linear | result
1474 -c -C -n -m dirty rev linear | result
1473 y y * * * * | (1)
1475 y y * * * * * | (1)
1474 y * y * * * | (1)
1476 y * y * * * * | (1)
1475 * y y * * * | (1)
1477 y * * y * * * | (1)
1476 * * * * n n | x
1478 * y y * * * * | (1)
1477 * * * n * * | ok
1479 * y * y * * * | (1)
1478 n n n y * y | merge
1480 * * y y * * * | (1)
1479 n n n y y n | (2)
1481 * * * * * n n | x
1480 n n y y * * | merge
1482 * * * * n * * | ok
1481 n y n y * * | discard
1483 n n n n y * y | merge
1482 y n n y * * | (3)
1484 n n n n y y n | (2)
1485 n n n y y * * | merge
1486 n n y n y * * | merge if no conflict
1487 n y n n y * * | discard
1488 y n n n y * * | (3)
1483
1489
1484 x = can't happen
1490 x = can't happen
1485 * = don't-care
1491 * = don't-care
@@ -1499,7 +1505,7 b' def update(repo, node, branchmerge, forc'
1499 # updatecheck='abort' to better suppport some of these callers.
1505 # updatecheck='abort' to better suppport some of these callers.
1500 if updatecheck is None:
1506 if updatecheck is None:
1501 updatecheck = 'linear'
1507 updatecheck = 'linear'
1502 assert updatecheck in ('none', 'linear')
1508 assert updatecheck in ('none', 'linear', 'noconflict')
1503 # If we're doing a partial update, we need to skip updating
1509 # If we're doing a partial update, we need to skip updating
1504 # the dirstate, so make a note of any partial-ness to the
1510 # the dirstate, so make a note of any partial-ness to the
1505 # update here.
1511 # update here.
@@ -1593,6 +1599,13 b' def update(repo, node, branchmerge, forc'
1593 repo, wc, p2, pas, branchmerge, force, mergeancestor,
1599 repo, wc, p2, pas, branchmerge, force, mergeancestor,
1594 followcopies, matcher=matcher, mergeforce=mergeforce)
1600 followcopies, matcher=matcher, mergeforce=mergeforce)
1595
1601
1602 if updatecheck == 'noconflict':
1603 for f, (m, args, msg) in actionbyfile.iteritems():
1604 if m not in ('g', 'k', 'r'):
1605 msg = _("uncommitted changes")
1606 hint = _("commit or update --merge to allow merge")
1607 raise error.Abort(msg, hint=hint)
1608
1596 # Prompt and create actions. Most of this is in the resolve phase
1609 # Prompt and create actions. Most of this is in the resolve phase
1597 # already, but we can't handle .hgsubstate in filemerge or
1610 # already, but we can't handle .hgsubstate in filemerge or
1598 # subrepo.submerge yet so we have to keep prompting for it.
1611 # subrepo.submerge yet so we have to keep prompting for it.
@@ -255,6 +255,65 b' Cases are run as shown in that table, ro'
255 >>>>>>> destination: d047485b3896 b1 - test: 4
255 >>>>>>> destination: d047485b3896 b1 - test: 4
256 $ rm a.orig
256 $ rm a.orig
257
257
258 $ echo 'updatecheck = noconflict' >> .hg/hgrc
259
260 $ revtest 'none dirty cross' dirty 3 4
261 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
262 parent=4
263 M foo
264
265 $ revtest 'none dirty linear' dirty 1 2
266 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
267 parent=2
268 M foo
269
270 $ revtest 'none dirty linear' dirty 1 2 -c
271 abort: uncommitted changes
272 parent=1
273 M foo
274
275 $ revtest 'none dirty linear' dirty 1 2 -C
276 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
277 parent=2
278
279 Locally added file is allowed
280 $ hg up -qC 3
281 $ echo a > bar
282 $ hg add bar
283 $ hg up -q 4
284 $ hg st
285 A bar
286 $ hg forget bar
287 $ rm bar
288
289 Locally removed file is allowed
290 $ hg up -qC 3
291 $ hg rm a
292 $ hg up -q 4
293 abort: uncommitted changes
294 (commit or update --merge to allow merge)
295 [255]
296
297 File conflict is not allowed
298 $ hg up -qC 3
299 $ echo dirty >> a
300 $ hg up -q 4
301 abort: uncommitted changes
302 (commit or update --merge to allow merge)
303 [255]
304 $ hg up -m 4
305 merging a
306 warning: conflicts while merging a! (edit, then use 'hg resolve --mark')
307 0 files updated, 0 files merged, 0 files removed, 1 files unresolved
308 use 'hg resolve' to retry unresolved file merges
309 [1]
310 $ rm a.orig
311
312 Change/delete conflict is not allowed
313 $ hg up -qC 3
314 $ hg rm foo
315 $ hg up -q 4
316
258 Uses default value of "linear" when value is misspelled
317 Uses default value of "linear" when value is misspelled
259 $ echo 'updatecheck = linyar' >> .hg/hgrc
318 $ echo 'updatecheck = linyar' >> .hg/hgrc
260
319
General Comments 0
You need to be logged in to leave comments. Login now