Patchwork largefiles: report the source of copied/moved largefiles in status -C

login
register
mail settings
Submitter Matt Harbison
Date March 8, 2015, 8:12 p.m.
Message ID <73191a7fdebbf8aa518e.1425845549@Envy>
Download mbox | patch
Permalink /patch/7946/
State Accepted
Headers show

Comments

Matt Harbison - March 8, 2015, 8:12 p.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1422171949 18000
#      Sun Jan 25 02:45:49 2015 -0500
# Node ID 73191a7fdebbf8aa518eef5a65abb25678c5781f
# Parent  02d7b5cd373bbb4e8263dad9bfbf9c4c3b0e4e3a
largefiles: report the source of copied/moved largefiles in status -C

Previously, the source was silently skipped because the largefile was in the
list of changed files, but the standin was in the copies dictionary.  The source
is only displayed if the changed file is a key in the copies dictionary.
Matt Mackall - March 9, 2015, 7:09 p.m.
On Sun, 2015-03-08 at 16:12 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1422171949 18000
> #      Sun Jan 25 02:45:49 2015 -0500
> # Node ID 73191a7fdebbf8aa518eef5a65abb25678c5781f
> # Parent  02d7b5cd373bbb4e8263dad9bfbf9c4c3b0e4e3a
> largefiles: report the source of copied/moved largefiles in status -C

Queued for default, thanks.

Patch

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -578,6 +578,15 @@ 
         repo.wwrite(fcd.path(), fco.data(), fco.flags())
     return 0
 
+def copiespathcopies(orig, ctx1, ctx2):
+    copies = orig(ctx1, ctx2)
+    updated = {}
+
+    for k, v in copies.iteritems():
+        updated[lfutil.splitstandin(k) or k] = lfutil.splitstandin(v) or v
+
+    return updated
+
 # Copy first changes the matchers to match standins instead of
 # largefiles.  Then it overrides util.copyfile in that function it
 # checks if the destination largefile already exists. It also keeps a
diff --git a/hgext/largefiles/uisetup.py b/hgext/largefiles/uisetup.py
--- a/hgext/largefiles/uisetup.py
+++ b/hgext/largefiles/uisetup.py
@@ -9,7 +9,7 @@ 
 '''setup for largefiles extension: uisetup'''
 
 from mercurial import archival, cmdutil, commands, extensions, filemerge, hg, \
-    httppeer, merge, scmutil, sshpeer, wireproto, revset, subrepo
+    httppeer, merge, scmutil, sshpeer, wireproto, revset, subrepo, copies
 from mercurial.i18n import _
 from mercurial.hgweb import hgweb_mod, webcommands
 
@@ -37,6 +37,8 @@ 
     extensions.wrapfunction(cmdutil, 'remove', overrides.cmdutilremove)
     extensions.wrapfunction(cmdutil, 'forget', overrides.cmdutilforget)
 
+    extensions.wrapfunction(copies, 'pathcopies', overrides.copiespathcopies)
+
     # Subrepos call status function
     entry = extensions.wrapcommand(commands.table, 'status',
                                    overrides.overridestatus)
diff --git a/tests/test-subrepo-deep-nested-change.t b/tests/test-subrepo-deep-nested-change.t
--- a/tests/test-subrepo-deep-nested-change.t
+++ b/tests/test-subrepo-deep-nested-change.t
@@ -419,4 +419,24 @@ 
   A a.dat
   A a.txt
 
+  $ hg ci -m "add a.*"
+  $ hg mv a.dat b.dat
+  $ hg mv foo/bar/abc foo/bar/def
+  $ hg status -C
+  A b.dat
+    a.dat
+  A foo/bar/def
+    foo/bar/abc
+  R a.dat
+  R foo/bar/abc
+
+  $ hg ci -m "move large and normal"
+  $ hg status -C --rev '.^' --rev .
+  A b.dat
+    a.dat
+  A foo/bar/def
+    foo/bar/abc
+  R a.dat
+  R foo/bar/abc
+
   $ cd ..