##// END OF EJS Templates
merge: don't overwrite untracked file at directory rename target...
Martin von Zweigbergk -
r23653:0297d846 default
parent child Browse files
Show More
@@ -405,10 +405,10 b' def overrideupdate(orig, ui, repo, *pats'
405 # The overridden function filters the unknown files by removing any
405 # The overridden function filters the unknown files by removing any
406 # largefiles. This makes the merge proceed and we can then handle this
406 # largefiles. This makes the merge proceed and we can then handle this
407 # case further in the overridden calculateupdates function below.
407 # case further in the overridden calculateupdates function below.
408 def overridecheckunknownfile(origfn, repo, wctx, mctx, f):
408 def overridecheckunknownfile(origfn, repo, wctx, mctx, f, f2=None):
409 if lfutil.standin(repo.dirstate.normalize(f)) in wctx:
409 if lfutil.standin(repo.dirstate.normalize(f)) in wctx:
410 return False
410 return False
411 return origfn(repo, wctx, mctx, f)
411 return origfn(repo, wctx, mctx, f, f2)
412
412
413 # The manifest merge handles conflicts on the manifest level. We want
413 # The manifest merge handles conflicts on the manifest level. We want
414 # to handle changes in largefile-ness of files at this level too.
414 # to handle changes in largefile-ness of files at this level too.
@@ -297,11 +297,13 b' class mergestate(object):'
297 self.mark(dfile, 'r')
297 self.mark(dfile, 'r')
298 return r
298 return r
299
299
300 def _checkunknownfile(repo, wctx, mctx, f):
300 def _checkunknownfile(repo, wctx, mctx, f, f2=None):
301 if f2 is None:
302 f2 = f
301 return (os.path.isfile(repo.wjoin(f))
303 return (os.path.isfile(repo.wjoin(f))
302 and repo.wopener.audit.check(f)
304 and repo.wopener.audit.check(f)
303 and repo.dirstate.normalize(f) not in repo.dirstate
305 and repo.dirstate.normalize(f) not in repo.dirstate
304 and mctx[f].cmp(wctx[f]))
306 and mctx[f2].cmp(wctx[f]))
305
307
306 def _forgetremoved(wctx, mctx, branchmerge):
308 def _forgetremoved(wctx, mctx, branchmerge):
307 """
309 """
@@ -517,6 +519,9 b' def manifestmerge(repo, wctx, p2, pa, br'
517 if m in ('c', 'dc'):
519 if m in ('c', 'dc'):
518 if _checkunknownfile(repo, wctx, p2, f):
520 if _checkunknownfile(repo, wctx, p2, f):
519 aborts.append(f)
521 aborts.append(f)
522 elif m == 'dg':
523 if _checkunknownfile(repo, wctx, p2, f, args[0]):
524 aborts.append(f)
520
525
521 for f in sorted(aborts):
526 for f in sorted(aborts):
522 repo.ui.warn(_("%s: untracked file differs\n") % f)
527 repo.ui.warn(_("%s: untracked file differs\n") % f)
@@ -108,21 +108,23 b''
108 Local directory rename with conflicting file added in remote source directory
108 Local directory rename with conflicting file added in remote source directory
109 and untracked in local target directory.
109 and untracked in local target directory.
110
110
111 BROKEN: the uncommitted file is overwritten; we should abort
112
113 $ hg co -qC 1
111 $ hg co -qC 1
114 $ echo target > b/c
112 $ echo target > b/c
115 $ hg merge 2
113 $ hg merge 2
114 b/c: untracked file differs
115 abort: untracked files in working directory differ from files in requested revision
116 [255]
117 $ cat b/c
118 target
119 but it should succeed if the content matches
120 $ hg cat -r 2 a/c > b/c
121 $ hg merge 2
116 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
122 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
117 (branch merge, don't forget to commit)
123 (branch merge, don't forget to commit)
118 $ hg st -A
124 $ hg st -C
119 A b/c
125 A b/c
120 a/c
126 a/c
121 ? a/d
127 ? a/d
122 C b/a
123 C b/b
124 $ cat b/c
125 baz
126
128
127 Local directory rename with conflicting file added in remote source directory
129 Local directory rename with conflicting file added in remote source directory
128 and committed in local target directory.
130 and committed in local target directory.
General Comments 0
You need to be logged in to leave comments. Login now