##// END OF EJS Templates
merge: check for path conflicts when updating (issue5628)...
Mark Thomas -
r34553:33c8a683 default
parent child Browse files
Show More
@@ -676,6 +676,7 b' def _checkunknownfiles(repo, wctx, mctx,'
676 676 choose a different action.
677 677 """
678 678 fileconflicts = set()
679 pathconflicts = set()
679 680 warnconflicts = set()
680 681 abortconflicts = set()
681 682 unknownconfig = _getcheckunknownconfig(repo, 'merge', 'checkunknown')
@@ -691,11 +692,15 b' def _checkunknownfiles(repo, wctx, mctx,'
691 692 if m in ('c', 'dc'):
692 693 if _checkunknownfile(repo, wctx, mctx, f):
693 694 fileconflicts.add(f)
695 elif f not in wctx:
696 path = _checkunknowndirs(repo, f)
697 if path is not None:
698 pathconflicts.add(path)
694 699 elif m == 'dg':
695 700 if _checkunknownfile(repo, wctx, mctx, f, args[0]):
696 701 fileconflicts.add(f)
697 702
698 allconflicts = fileconflicts
703 allconflicts = fileconflicts | pathconflicts
699 704 ignoredconflicts = set([c for c in allconflicts
700 705 if repo.dirstate._ignore(c)])
701 706 unknownconflicts = allconflicts - ignoredconflicts
@@ -745,8 +750,9 b' def _checkunknownfiles(repo, wctx, mctx,'
745 750 repo.ui.warn(_("%s: replacing untracked file\n") % f)
746 751
747 752 for f, (m, args, msg) in actions.iteritems():
748 backup = f in fileconflicts
749 753 if m == 'c':
754 backup = (f in fileconflicts or f in pathconflicts or
755 any(p in pathconflicts for p in util.finddirs(f)))
750 756 flags, = args
751 757 actions[f] = ('g', (flags, backup), msg)
752 758
@@ -30,17 +30,17 b" of the files in a commit we're updating "
30 30
31 31 $ mkdir b && touch b/nonempty
32 32 $ hg up
33 abort: *: '$TESTTMP/t/b' (glob)
33 b: untracked file differs
34 abort: untracked files in working directory differ from files in requested revision
34 35 [255]
35 36 $ hg ci
36 abort: last update was interrupted
37 (use 'hg update' to get a consistent checkout)
38 [255]
37 nothing changed
38 [1]
39 39 $ hg sum
40 40 parent: 0:538afb845929
41 41 commit #0
42 42 branch: default
43 commit: 1 unknown (interrupted update)
43 commit: 1 unknown (clean)
44 44 update: 1 new changesets (update)
45 45 phases: 2 draft
46 46 $ rm b/nonempty
@@ -37,7 +37,8 b' Basic update - local directory conflicts'
37 37 $ mkdir a
38 38 $ echo 3 > a/b
39 39 $ hg up file
40 abort: *: '$TESTTMP/repo/a' (glob)
40 a: untracked file differs
41 abort: untracked files in working directory differ from files in requested revision
41 42 [255]
42 43 $ hg up --clean file
43 44 abort: *: '$TESTTMP/repo/a' (glob)
@@ -53,13 +54,9 b' Basic update - untracked file conflicts '
53 54 $ hg up -q 0
54 55 $ echo untracked > a
55 56 $ hg up --config merge.checkunknown=warn dir
56 abort: *: '$TESTTMP/repo/a/b' (glob)
57 [255]
58
59 Repo is in a very bad state now - recover manually
60
61 $ rm -f a
62 $ hg up -q --clean 0
57 a: replacing untracked file
58 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
59 (activating bookmark dir)
63 60
64 61 Basic clean update - local directory conflicts with changed remote file
65 62
@@ -50,7 +50,8 b' make sure that this does not erase untra'
50 50 $ hg st
51 51 ? name/file
52 52 $ hg up 1
53 abort: *: '$TESTTMP/r1/r2/name' (glob)
53 name: untracked file differs
54 abort: untracked files in working directory differ from files in requested revision
54 55 [255]
55 56 $ cd ..
56 57
General Comments 0
You need to be logged in to leave comments. Login now