Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/filemerge.py @ 27032:28ee7af4b685
filemerge: return whether the file is deleted for nomerge internal tools
We're going to support the filemerge code resolving change/delete conflicts in
upcoming patches. Some of these resolutions require that the dirstate be
modified. Modifying the dirstate directly from in here would be (a) a pretty
bad layering violation and (b) wrong because all dirstate removals should
happen before adds. So in this and upcoming patches we're instead going to pass
whether the file is deleted up to merge.mergestate, then in there figure out
what dirstate action needs to be taken.
author | Siddharth Agarwal <sid0@fb.com> |
---|---|
date | Wed, 18 Nov 2015 13:52:28 -0800 |
parents | 7b038ec6c5fd |
children | 089dab8794dc |
comparison
equal
deleted
inserted
replaced
27031:8be0af32e513 | 27032:28ee7af4b685 |
---|---|
230 return _iother(repo, mynode, orig, fcd, fco, fca, toolconf) | 230 return _iother(repo, mynode, orig, fcd, fco, fca, toolconf) |
231 else: | 231 else: |
232 return _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf) | 232 return _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf) |
233 except error.ResponseExpected: | 233 except error.ResponseExpected: |
234 ui.write("\n") | 234 ui.write("\n") |
235 return 1 | 235 return 1, False |
236 | 236 |
237 @internaltool('local', nomerge) | 237 @internaltool('local', nomerge) |
238 def _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf): | 238 def _ilocal(repo, mynode, orig, fcd, fco, fca, toolconf): |
239 """Uses the local version of files as the merged version.""" | 239 """Uses the local version of files as the merged version.""" |
240 return 0 | 240 return 0, False |
241 | 241 |
242 @internaltool('other', nomerge) | 242 @internaltool('other', nomerge) |
243 def _iother(repo, mynode, orig, fcd, fco, fca, toolconf): | 243 def _iother(repo, mynode, orig, fcd, fco, fca, toolconf): |
244 """Uses the other version of files as the merged version.""" | 244 """Uses the other version of files as the merged version.""" |
245 repo.wwrite(fcd.path(), fco.data(), fco.flags()) | 245 repo.wwrite(fcd.path(), fco.data(), fco.flags()) |
246 return 0 | 246 return 0, False |
247 | 247 |
248 @internaltool('fail', nomerge) | 248 @internaltool('fail', nomerge) |
249 def _ifail(repo, mynode, orig, fcd, fco, fca, toolconf): | 249 def _ifail(repo, mynode, orig, fcd, fco, fca, toolconf): |
250 """ | 250 """ |
251 Rather than attempting to merge files that were modified on both | 251 Rather than attempting to merge files that were modified on both |
252 branches, it marks them as unresolved. The resolve command must be | 252 branches, it marks them as unresolved. The resolve command must be |
253 used to resolve these conflicts.""" | 253 used to resolve these conflicts.""" |
254 return 1 | 254 return 1, False |
255 | 255 |
256 def _premerge(repo, toolconf, files, labels=None): | 256 def _premerge(repo, toolconf, files, labels=None): |
257 tool, toolpath, binary, symlink = toolconf | 257 tool, toolpath, binary, symlink = toolconf |
258 if symlink: | 258 if symlink: |
259 return 1 | 259 return 1 |
534 precheck = None | 534 precheck = None |
535 | 535 |
536 toolconf = tool, toolpath, binary, symlink | 536 toolconf = tool, toolpath, binary, symlink |
537 | 537 |
538 if mergetype == nomerge: | 538 if mergetype == nomerge: |
539 return True, func(repo, mynode, orig, fcd, fco, fca, toolconf) | 539 r, deleted = func(repo, mynode, orig, fcd, fco, fca, toolconf) |
540 return True, r | |
540 | 541 |
541 if premerge: | 542 if premerge: |
542 if orig != fco.path(): | 543 if orig != fco.path(): |
543 ui.status(_("merging %s and %s to %s\n") % (orig, fco.path(), fd)) | 544 ui.status(_("merging %s and %s to %s\n") % (orig, fco.path(), fd)) |
544 else: | 545 else: |