Patchwork [1,of,4] largefiles: avoid redundant "updatelfiles" invocation in "overridetransplant"

login
register
mail settings
Submitter Katsunori FUJIWARA
Date Nov. 7, 2014, 3:52 p.m.
Message ID <3bdc023bdf819da681a4.1415375525@feefifofum>
Download mbox | patch
Permalink /patch/6634/
State Accepted
Commit 236c978bcecac8453aa43c79f8ed9d5bfd24d425
Headers show

Comments

Katsunori FUJIWARA - Nov. 7, 2014, 3:52 p.m.
# HG changeset patch
# User FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
# Date 1415375318 -32400
#      Sat Nov 08 00:48:38 2014 +0900
# Node ID 3bdc023bdf819da681a4e94f9d3741749372b664
# Parent  2d54aa5397cdb1c697673ba10b7618d5ac25c69e
largefiles: avoid redundant "updatelfiles" invocation in "overridetransplant"

At "hg transplant --merge REV", largefiles newly coming from the 2nd
parent (= REV) are marked as "a"(dded) by "patch.patch()", and have to
be marked as "n"(ormal) after commit.

But until changeset 3100d1cbce32, such largefiles were still marked as
"a" unexpectedly even after commit, because no additional entry is
added to filelog of such largefiles and they aren't listed in
"repo[newnode].files()" in this case: "newnode" is one of newly
committed changeset (= result of "repo.commit()").

"updatelfiles" invocation in "overridetransplant" shadows this problem
by forcibly synchronizing lfdirstate to dirstate.

Now, "updatelfiles" invocation in "overridetransplant" is redundant,
because changeset 3100d1cbce32 made "markcommitted" use "ctx.files()"
to get targets of "synclfdirstate" instead of "repo[newnode].files()".

Patch

diff --git a/hgext/largefiles/lfutil.py b/hgext/largefiles/lfutil.py
--- a/hgext/largefiles/lfutil.py
+++ b/hgext/largefiles/lfutil.py
@@ -392,6 +392,15 @@ 
 
     orig(node)
 
+    # ATTENTION: "ctx.files()" may differ from "repo[node].files()"
+    # because files coming from the 2nd parent are omitted in the latter.
+    #
+    # The former should be used to get targets of "synclfdirstate",
+    # because such files:
+    # - are marked as "a" by "patch.patch()" (e.g. via transplant), and
+    # - have to be marked as "n" after commit, but
+    # - aren't listed in "repo[node].files()"
+
     lfdirstate = openlfdirstate(repo.ui, repo)
     for f in ctx.files():
         if isstandin(f):
diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -1169,13 +1169,8 @@ 
 
 def overridetransplant(orig, ui, repo, *revs, **opts):
     try:
-        oldstandins = lfutil.getstandinsstate(repo)
         repo._istransplanting = True
         result = orig(ui, repo, *revs, **opts)
-        newstandins = lfutil.getstandinsstate(repo)
-        filelist = lfutil.getlfilestoupdate(oldstandins, newstandins)
-        lfcommands.updatelfiles(repo.ui, repo, filelist=filelist,
-                                printmessage=True)
     finally:
         repo._istransplanting = False
     return result
diff --git a/tests/test-largefiles.t b/tests/test-largefiles.t
--- a/tests/test-largefiles.t
+++ b/tests/test-largefiles.t
@@ -1740,8 +1740,6 @@ 
   adding manifests
   adding file changes
   added 1 changesets with 2 changes to 2 files
-  getting changed largefiles
-  0 largefiles updated, 0 removed
   $ hg log --template '{rev}:{node|short}  {desc|firstline}\n'
   9:598410d3eb9a  modify normal file largefile in repo d
   8:a381d2c8c80e  modify normal file and largefile in repo b