##// 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 choose a different action.
676 choose a different action.
677 """
677 """
678 fileconflicts = set()
678 fileconflicts = set()
679 pathconflicts = set()
679 warnconflicts = set()
680 warnconflicts = set()
680 abortconflicts = set()
681 abortconflicts = set()
681 unknownconfig = _getcheckunknownconfig(repo, 'merge', 'checkunknown')
682 unknownconfig = _getcheckunknownconfig(repo, 'merge', 'checkunknown')
@@ -691,11 +692,15 b' def _checkunknownfiles(repo, wctx, mctx,'
691 if m in ('c', 'dc'):
692 if m in ('c', 'dc'):
692 if _checkunknownfile(repo, wctx, mctx, f):
693 if _checkunknownfile(repo, wctx, mctx, f):
693 fileconflicts.add(f)
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 elif m == 'dg':
699 elif m == 'dg':
695 if _checkunknownfile(repo, wctx, mctx, f, args[0]):
700 if _checkunknownfile(repo, wctx, mctx, f, args[0]):
696 fileconflicts.add(f)
701 fileconflicts.add(f)
697
702
698 allconflicts = fileconflicts
703 allconflicts = fileconflicts | pathconflicts
699 ignoredconflicts = set([c for c in allconflicts
704 ignoredconflicts = set([c for c in allconflicts
700 if repo.dirstate._ignore(c)])
705 if repo.dirstate._ignore(c)])
701 unknownconflicts = allconflicts - ignoredconflicts
706 unknownconflicts = allconflicts - ignoredconflicts
@@ -745,8 +750,9 b' def _checkunknownfiles(repo, wctx, mctx,'
745 repo.ui.warn(_("%s: replacing untracked file\n") % f)
750 repo.ui.warn(_("%s: replacing untracked file\n") % f)
746
751
747 for f, (m, args, msg) in actions.iteritems():
752 for f, (m, args, msg) in actions.iteritems():
748 backup = f in fileconflicts
749 if m == 'c':
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 flags, = args
756 flags, = args
751 actions[f] = ('g', (flags, backup), msg)
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 $ mkdir b && touch b/nonempty
31 $ mkdir b && touch b/nonempty
32 $ hg up
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 [255]
35 [255]
35 $ hg ci
36 $ hg ci
36 abort: last update was interrupted
37 nothing changed
37 (use 'hg update' to get a consistent checkout)
38 [1]
38 [255]
39 $ hg sum
39 $ hg sum
40 parent: 0:538afb845929
40 parent: 0:538afb845929
41 commit #0
41 commit #0
42 branch: default
42 branch: default
43 commit: 1 unknown (interrupted update)
43 commit: 1 unknown (clean)
44 update: 1 new changesets (update)
44 update: 1 new changesets (update)
45 phases: 2 draft
45 phases: 2 draft
46 $ rm b/nonempty
46 $ rm b/nonempty
@@ -37,7 +37,8 b' Basic update - local directory conflicts'
37 $ mkdir a
37 $ mkdir a
38 $ echo 3 > a/b
38 $ echo 3 > a/b
39 $ hg up file
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 [255]
42 [255]
42 $ hg up --clean file
43 $ hg up --clean file
43 abort: *: '$TESTTMP/repo/a' (glob)
44 abort: *: '$TESTTMP/repo/a' (glob)
@@ -53,13 +54,9 b' Basic update - untracked file conflicts '
53 $ hg up -q 0
54 $ hg up -q 0
54 $ echo untracked > a
55 $ echo untracked > a
55 $ hg up --config merge.checkunknown=warn dir
56 $ hg up --config merge.checkunknown=warn dir
56 abort: *: '$TESTTMP/repo/a/b' (glob)
57 a: replacing untracked file
57 [255]
58 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
58
59 (activating bookmark dir)
59 Repo is in a very bad state now - recover manually
60
61 $ rm -f a
62 $ hg up -q --clean 0
63
60
64 Basic clean update - local directory conflicts with changed remote file
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 $ hg st
50 $ hg st
51 ? name/file
51 ? name/file
52 $ hg up 1
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 [255]
55 [255]
55 $ cd ..
56 $ cd ..
56
57
General Comments 0
You need to be logged in to leave comments. Login now