##// END OF EJS Templates
rebase: respect checkunknown and checkignored in more cases...
Siddharth Agarwal -
r28022:e397b58c default
parent child Browse files
Show More
@@ -634,6 +634,39 b' def _checkunknownfiles(repo, wctx, mctx,'
634 unknownconflicts = conflicts - ignoredconflicts
634 unknownconflicts = conflicts - ignoredconflicts
635 collectconflicts(ignoredconflicts, ignoredconfig)
635 collectconflicts(ignoredconflicts, ignoredconfig)
636 collectconflicts(unknownconflicts, unknownconfig)
636 collectconflicts(unknownconflicts, unknownconfig)
637 else:
638 for f, (m, args, msg) in actions.iteritems():
639 if m == 'cm':
640 fl2, anc = args
641 different = _checkunknownfile(repo, wctx, mctx, f)
642 if repo.dirstate._ignore(f):
643 config = ignoredconfig
644 else:
645 config = unknownconfig
646
647 # The behavior when force is True is described by this table:
648 # config different mergeforce | action backup
649 # * n * | get n
650 # * y y | merge -
651 # abort y n | merge - (1)
652 # warn y n | warn + get y
653 # ignore y n | get y
654 #
655 # (1) this is probably the wrong behavior here -- we should
656 # probably abort, but some actions like rebases currently
657 # don't like an abort happening in the middle of
658 # merge.update.
659 if not different:
660 actions[f] = ('g', (fl2, False), "remote created")
661 elif mergeforce or config == 'abort':
662 actions[f] = ('m', (f, f, None, False, anc),
663 "remote differs from untracked local")
664 elif config == 'abort':
665 abortconflicts.add(f)
666 else:
667 if config == 'warn':
668 warnconflicts.add(f)
669 actions[f] = ('g', (fl2, True), "remote created")
637
670
638 for f in sorted(abortconflicts):
671 for f in sorted(abortconflicts):
639 repo.ui.warn(_("%s: untracked file differs\n") % f)
672 repo.ui.warn(_("%s: untracked file differs\n") % f)
@@ -649,14 +682,6 b' def _checkunknownfiles(repo, wctx, mctx,'
649 if m == 'c':
682 if m == 'c':
650 flags, = args
683 flags, = args
651 actions[f] = ('g', (flags, backup), msg)
684 actions[f] = ('g', (flags, backup), msg)
652 elif m == 'cm':
653 fl2, anc = args
654 different = _checkunknownfile(repo, wctx, mctx, f)
655 if different:
656 actions[f] = ('m', (f, f, None, False, anc),
657 "remote differs from untracked local")
658 else:
659 actions[f] = ('g', (fl2, backup), "remote created")
660
685
661 def _forgetremoved(wctx, mctx, branchmerge):
686 def _forgetremoved(wctx, mctx, branchmerge):
662 """
687 """
@@ -25,7 +25,8 b''
25
25
26 Rebasing
26 Rebasing
27 D onto H - simple rebase:
27 D onto H - simple rebase:
28 (this also tests that editor is invoked if '--edit' is specified)
28 (this also tests that editor is invoked if '--edit' is specified, and that we
29 can abort or warn for colliding untracked files)
29
30
30 $ hg clone -q -u . a a1
31 $ hg clone -q -u . a a1
31 $ cd a1
32 $ cd a1
@@ -50,8 +51,10 b' D onto H - simple rebase:'
50
51
51 $ hg status --rev "3^1" --rev 3
52 $ hg status --rev "3^1" --rev 3
52 A D
53 A D
53 $ HGEDITOR=cat hg rebase -s 3 -d 7 --edit
54 $ echo collide > D
55 $ HGEDITOR=cat hg rebase -s 3 -d 7 --edit --config merge.checkunknown=warn
54 rebasing 3:32af7686d403 "D"
56 rebasing 3:32af7686d403 "D"
57 D: replacing untracked file
55 D
58 D
56
59
57
60
@@ -62,6 +65,9 b' D onto H - simple rebase:'
62 HG: branch 'default'
65 HG: branch 'default'
63 HG: added D
66 HG: added D
64 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/32af7686d403-6f7dface-backup.hg (glob)
67 saved backup bundle to $TESTTMP/a1/.hg/strip-backup/32af7686d403-6f7dface-backup.hg (glob)
68 $ cat D.orig
69 collide
70 $ rm D.orig
65
71
66 $ hg tglog
72 $ hg tglog
67 o 7: 'D'
73 o 7: 'D'
@@ -84,14 +90,19 b' D onto H - simple rebase:'
84
90
85
91
86 D onto F - intermediate point:
92 D onto F - intermediate point:
87 (this also tests that editor is not invoked if '--edit' is not specified)
93 (this also tests that editor is not invoked if '--edit' is not specified, and
94 that we can ignore for colliding untracked files)
88
95
89 $ hg clone -q -u . a a2
96 $ hg clone -q -u . a a2
90 $ cd a2
97 $ cd a2
98 $ echo collide > D
91
99
92 $ HGEDITOR=cat hg rebase -s 3 -d 5
100 $ HGEDITOR=cat hg rebase -s 3 -d 5 --config merge.checkunknown=ignore
93 rebasing 3:32af7686d403 "D"
101 rebasing 3:32af7686d403 "D"
94 saved backup bundle to $TESTTMP/a2/.hg/strip-backup/32af7686d403-6f7dface-backup.hg (glob)
102 saved backup bundle to $TESTTMP/a2/.hg/strip-backup/32af7686d403-6f7dface-backup.hg (glob)
103 $ cat D.orig
104 collide
105 $ rm D.orig
95
106
96 $ hg tglog
107 $ hg tglog
97 o 7: 'D'
108 o 7: 'D'
@@ -114,15 +125,21 b' D onto F - intermediate point:'
114
125
115
126
116 E onto H - skip of G:
127 E onto H - skip of G:
128 (this also tests that we can overwrite untracked files and don't create backups
129 if they have the same contents)
117
130
118 $ hg clone -q -u . a a3
131 $ hg clone -q -u . a a3
119 $ cd a3
132 $ cd a3
133 $ hg cat -r 4 E | tee E
134 E
120
135
121 $ hg rebase -s 4 -d 7
136 $ hg rebase -s 4 -d 7
122 rebasing 4:9520eea781bc "E"
137 rebasing 4:9520eea781bc "E"
123 rebasing 6:eea13746799a "G"
138 rebasing 6:eea13746799a "G"
124 note: rebase of 6:eea13746799a created no changes to commit
139 note: rebase of 6:eea13746799a created no changes to commit
125 saved backup bundle to $TESTTMP/a3/.hg/strip-backup/9520eea781bc-fcd8edd4-backup.hg (glob)
140 saved backup bundle to $TESTTMP/a3/.hg/strip-backup/9520eea781bc-fcd8edd4-backup.hg (glob)
141 $ f E.orig
142 E.orig: file not found
126
143
127 $ hg tglog
144 $ hg tglog
128 o 6: 'E'
145 o 6: 'E'
General Comments 0
You need to be logged in to leave comments. Login now