[PATCH 4 of 4 mergedriver] merge: move almost all change/delete conflicts to resolve phase (BC) (API)

Yuya Nishihara yuya at tcha.org
Sat Dec 5 03:49:41 CST 2015


On Thu, 03 Dec 2015 22:19:44 -0500, Matt Harbison wrote:
> Not sure why, but I'm seeing this on Windows:
> 
> --- c:/Users/Matt/Projects/hg/tests/test-subrepo-missing.t
> +++ c:/Users/Matt/Projects/hg/tests/test-subrepo-missing.t.err
> @@ -64,8 +64,12 @@
>     $ hg up 0
>     remote changed .hgsubstate which local deleted
>     use (c)hanged version or leave (d)eleted? c
> +   subrepository subrepo diverged (local revision: , remote revision:  
> 07f494440405)
> +  (M)erge, keep (l)ocal or keep (r)emote? m
> +  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
>     1 files updated, 0 files merged, 0 files removed, 0 files unresolved
>     $ hg st
> +  M .hgsubstate
>     $ ls subrepo
>     a
> 
> I'd write it off because you mention not dealing with .hgsubstate  
> conflicts below, but the test runs fine on Linux.  I didn't try OS X.  I  
> can file a bug if it isn't an issue you are aware of/have a ready fix for.

The problem is that wctx.substate can be stale after batchget or batchremove,
and it is loaded before applyupdates() on Windows.

--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -1056,6 +1056,11 @@ def applyupdates(repo, actions, wctx, mc
         progress(_updating, z, item=item, total=numupdates, unit=_files)
     updated = len(actions['g'])
 
+    # not sure this is right, but wctx can have stale cache after
+    # batchremove/updates, so we have to do something like this:
+    if removed or updated:
+        wctx = repo[None]
+
     if [a for a in actions['g'] if a[0] == '.hgsubstate']:
         subrepo.submerge(repo, wctx, mctx, wctx, overwrite)
 
@@ -1413,6 +1418,7 @@ def update(repo, node, branchmerge, forc
                 actions[m] = []
             actions[m].append((f, args, msg))
 
+        wc.substate  # on case-insensitive system, substate is loaded here
         if not util.checkcase(repo.path):
             # check collision between files only in p2 for clean update
             if (not branchmerge and


More information about the Mercurial-devel mailing list