Show More
@@ -987,6 +987,19 proxy. | |||||
987 | Optional. Always use the proxy, even for localhost and any entries |
|
987 | Optional. Always use the proxy, even for localhost and any entries | |
988 | in ``http_proxy.no``. (default: False) |
|
988 | in ``http_proxy.no``. (default: False) | |
989 |
|
989 | |||
|
990 | ``merge`` | |||
|
991 | --------- | |||
|
992 | ||||
|
993 | This section specifies behavior during merges and updates. | |||
|
994 | ||||
|
995 | ``checkunknown`` | |||
|
996 | Controls behavior when an unknown file on disk has the same name as a tracked | |||
|
997 | file in the changeset being merged or updated to, and has different | |||
|
998 | contents. Options are ``abort``, ``warn`` and ``ignore``. With ``abort``, | |||
|
999 | abort on such files. With ``warn``, warn on such files and back them up as | |||
|
1000 | .orig. With ``ignore``, don't print a warning and back them up as | |||
|
1001 | .orig. (default: ``abort``) | |||
|
1002 | ||||
990 | ``merge-patterns`` |
|
1003 | ``merge-patterns`` | |
991 | ------------------ |
|
1004 | ------------------ | |
992 |
|
1005 |
@@ -573,6 +573,14 def _checkunknownfiles(repo, wctx, mctx, | |||||
573 | """ |
|
573 | """ | |
574 | conflicts = set() |
|
574 | conflicts = set() | |
575 | if not force: |
|
575 | if not force: | |
|
576 | config = repo.ui.config('merge', 'checkunknown', default='abort') | |||
|
577 | valid = ['abort', 'ignore', 'warn'] | |||
|
578 | if config not in valid: | |||
|
579 | validstr = ', '.join(["'" + v + "'" for v in valid]) | |||
|
580 | raise error.ConfigError(_("merge.checkunknown not valid " | |||
|
581 | "('%s' is none of %s)") | |||
|
582 | % (config, validstr)) | |||
|
583 | ||||
576 | for f, (m, args, msg) in actions.iteritems(): |
|
584 | for f, (m, args, msg) in actions.iteritems(): | |
577 | if m in ('c', 'dc'): |
|
585 | if m in ('c', 'dc'): | |
578 | if _checkunknownfile(repo, wctx, mctx, f): |
|
586 | if _checkunknownfile(repo, wctx, mctx, f): | |
@@ -581,16 +589,21 def _checkunknownfiles(repo, wctx, mctx, | |||||
581 | if _checkunknownfile(repo, wctx, mctx, f, args[0]): |
|
589 | if _checkunknownfile(repo, wctx, mctx, f, args[0]): | |
582 | conflicts.add(f) |
|
590 | conflicts.add(f) | |
583 |
|
591 | |||
584 | for f in sorted(conflicts): |
|
592 | if config == 'abort': | |
585 | repo.ui.warn(_("%s: untracked file differs\n") % f) |
|
593 | for f in sorted(conflicts): | |
586 | if conflicts: |
|
594 | repo.ui.warn(_("%s: untracked file differs\n") % f) | |
587 | raise error.Abort(_("untracked files in working directory differ " |
|
595 | if conflicts: | |
588 | "from files in requested revision")) |
|
596 | raise error.Abort(_("untracked files in working directory " | |
|
597 | "differ from files in requested revision")) | |||
|
598 | elif config == 'warn': | |||
|
599 | for f in sorted(conflicts): | |||
|
600 | repo.ui.warn(_("%s: replacing untracked file\n") % f) | |||
589 |
|
601 | |||
590 | for f, (m, args, msg) in actions.iteritems(): |
|
602 | for f, (m, args, msg) in actions.iteritems(): | |
|
603 | backup = f in conflicts | |||
591 | if m == 'c': |
|
604 | if m == 'c': | |
592 | flags, = args |
|
605 | flags, = args | |
593 |
actions[f] = ('g', (flags, |
|
606 | actions[f] = ('g', (flags, backup), msg) | |
594 | elif m == 'cm': |
|
607 | elif m == 'cm': | |
595 | fl2, anc = args |
|
608 | fl2, anc = args | |
596 | different = _checkunknownfile(repo, wctx, mctx, f) |
|
609 | different = _checkunknownfile(repo, wctx, mctx, f) | |
@@ -598,7 +611,7 def _checkunknownfiles(repo, wctx, mctx, | |||||
598 | actions[f] = ('m', (f, f, None, False, anc), |
|
611 | actions[f] = ('m', (f, f, None, False, anc), | |
599 | "remote differs from untracked local") |
|
612 | "remote differs from untracked local") | |
600 | else: |
|
613 | else: | |
601 |
actions[f] = ('g', (fl2, |
|
614 | actions[f] = ('g', (fl2, backup), "remote created") | |
602 |
|
615 | |||
603 | def _forgetremoved(wctx, mctx, branchmerge): |
|
616 | def _forgetremoved(wctx, mctx, branchmerge): | |
604 | """ |
|
617 | """ |
@@ -124,7 +124,43 symlinks shouldn't be followed | |||||
124 | $ echo This is file b2 > b |
|
124 | $ echo This is file b2 > b | |
125 | #endif |
|
125 | #endif | |
126 |
|
126 | |||
127 | merge of b expected |
|
127 | bad config | |
|
128 | $ hg merge 1 --config merge.checkunknown=x | |||
|
129 | abort: merge.checkunknown not valid ('x' is none of 'abort', 'ignore', 'warn') | |||
|
130 | [255] | |||
|
131 | this merge should fail | |||
|
132 | $ hg merge 1 --config merge.checkunknown=abort | |||
|
133 | b: untracked file differs | |||
|
134 | abort: untracked files in working directory differ from files in requested revision | |||
|
135 | [255] | |||
|
136 | ||||
|
137 | this merge should warn | |||
|
138 | $ hg merge 1 --config merge.checkunknown=warn | |||
|
139 | b: replacing untracked file | |||
|
140 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
141 | (branch merge, don't forget to commit) | |||
|
142 | $ cat b.orig | |||
|
143 | This is file b2 | |||
|
144 | $ hg up --clean 2 | |||
|
145 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
146 | $ mv b.orig b | |||
|
147 | ||||
|
148 | this merge should silently ignore | |||
|
149 | $ cat b | |||
|
150 | This is file b2 | |||
|
151 | $ hg merge 1 --config merge.checkunknown=ignore | |||
|
152 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |||
|
153 | (branch merge, don't forget to commit) | |||
|
154 | ||||
|
155 | $ cat b.orig | |||
|
156 | This is file b2 | |||
|
157 | $ hg up --clean 2 | |||
|
158 | 0 files updated, 0 files merged, 1 files removed, 0 files unresolved | |||
|
159 | $ mv b.orig b | |||
|
160 | ||||
|
161 | this merge of b should work | |||
|
162 | $ cat b | |||
|
163 | This is file b2 | |||
128 | $ hg merge -f 1 |
|
164 | $ hg merge -f 1 | |
129 | merging b |
|
165 | merging b | |
130 | merging for b |
|
166 | merging for b |
General Comments 0
You need to be logged in to leave comments.
Login now