[PATCH 3 of 4 stable?] largefiles: don't show largefile/normal prompts if one side is unchanged

Mads Kiilerich mads at kiilerich.com
Sun Nov 30 19:33:00 CST 2014


# HG changeset patch
# User Mads Kiilerich <madski at unity3d.com>
# Date 1417396289 -3600
#      Mon Dec 01 02:11:29 2014 +0100
# Branch stable
# Node ID f4e4b477208f723b5edefda8ae1ff23266abc127
# Parent  81d67e247859b14e2c7cfb179bd94ccd70cf3bbb
largefiles: don't show largefile/normal prompts if one side is unchanged

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -438,10 +438,18 @@ def overridecalculateupdates(origfn, rep
             msg = _('remote turned local normal file %s into a largefile\n'
                     'use (l)argefile or keep (n)ormal file?'
                     '$$ &Largefile $$ &Normal file') % lfile
-            if repo.ui.promptchoice(msg, 0) == 0:
+            if (# local has unchanged normal file, pick remote largefile
+                pas and lfile in pas[0] and
+                pas[0][lfile].data() == p1[lfile].data() or
+                # if remote has unchanged largefile, pick local normal file
+                not (pas and standin in pas[0] and
+                     pas[0][standin].data() == p2[standin].data()) and
+                # else, prompt
+                repo.ui.promptchoice(msg, 0) == 0
+                ): # pick remote largefile
                 actions['r'].append((lfile, None, msg))
                 newglist.append((standin, (p2.flags(standin),), msg))
-            else:
+            else: # keep local normal file
                 actions['r'].append((standin, None, msg))
         elif lfutil.standin(f) in p1 and lfutil.standin(f) not in removes:
             # Case 2: largefile in the working copy, normal file in
@@ -451,7 +459,15 @@ def overridecalculateupdates(origfn, rep
             msg = _('remote turned local largefile %s into a normal file\n'
                     'keep (l)argefile or use (n)ormal file?'
                     '$$ &Largefile $$ &Normal file') % lfile
-            if repo.ui.promptchoice(msg, 0) == 0:
+            if (# if remote has unchanged normal file, pick local largefile
+                pas and f in pas[0] and
+                pas[0][f].data() == p2[f].data() or
+                # if local has unchanged largefile, pick remote normal file
+                not (pas and standin in pas[0] and
+                     pas[0][standin].data() == p1[standin].data()) and
+                # else, prompt
+                repo.ui.promptchoice(msg, 0) == 0
+                ): # keep local largefile
                 if branchmerge:
                     # largefile can be restored from standin safely
                     actions['r'].append((lfile, None, msg))
@@ -462,7 +478,7 @@ def overridecalculateupdates(origfn, rep
 
                     # linear-merge should treat this largefile as 're-added'
                     actions['a'].append((standin, None, msg))
-            else:
+            else: # pick remote normal file
                 actions['r'].append((standin, None, msg))
                 newglist.append((lfile, (p2.flags(lfile),), msg))
         else:
diff --git a/tests/test-issue3084.t b/tests/test-issue3084.t
--- a/tests/test-issue3084.t
+++ b/tests/test-issue3084.t
@@ -264,8 +264,6 @@ Ancestor: normal  Parent: normal-same  P
   $ hg merge -r large
   local changed f which remote deleted
   use (c)hanged version or (d)elete? c
-  remote turned local normal file f into a largefile
-  use (l)argefile or keep (n)ormal file? l
   getting changed largefiles
   1 largefiles updated, 0 removed
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -279,8 +277,6 @@ swap
   $ hg merge -r normal-same
   remote changed f which local deleted
   use (c)hanged version or leave (d)eleted? c
-  remote turned local largefile f into a normal file
-  keep (l)argefile or use (n)ormal file? l
   getting changed largefiles
   1 largefiles updated, 0 removed
   1 files updated, 0 files merged, 1 files removed, 0 files unresolved
@@ -393,14 +389,12 @@ Ancestor: large   Parent: large-same   P
   $ hg merge -r normal
   local changed .hglf/f which remote deleted
   use (c)hanged version or (d)elete? c
-  remote turned local largefile f into a normal file
-  keep (l)argefile or use (n)ormal file? l
   getting changed largefiles
-  1 largefiles updated, 0 removed
-  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  0 largefiles updated, 0 removed
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
   $ cat f
-  large
+  normal
 
 swap
 
@@ -408,14 +402,12 @@ swap
   $ hg merge -r large-same
   remote changed .hglf/f which local deleted
   use (c)hanged version or leave (d)eleted? c
-  remote turned local normal file f into a largefile
-  use (l)argefile or keep (n)ormal file? l
   getting changed largefiles
-  1 largefiles updated, 0 removed
-  2 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  0 largefiles updated, 0 removed
+  1 files updated, 0 files merged, 1 files removed, 0 files unresolved
   (branch merge, don't forget to commit)
   $ cat f
-  large
+  normal
 
 Ancestor: large   Parent: large2   Parent: normal  result: ?
 (annoying extra prompt ... but it do not do any serious harm)


More information about the Mercurial-devel mailing list