Patchwork [STABLE] extdiff: allow modifications in subrepos to be copied back

login
register
mail settings
Submitter Matt Harbison
Date July 27, 2015, 10:01 p.m.
Message ID <ff6acf895dc1971a6e2a.1438034471@waste.org>
Download mbox | patch
Permalink /patch/10067/
State Accepted
Headers show

Comments

Matt Harbison - July 27, 2015, 10:01 p.m.
# HG changeset patch
# User Matt Harbison <matt_harbison@yahoo.com>
# Date 1438033149 14400
#      Mon Jul 27 17:39:09 2015 -0400
# Branch stable
# Node ID ff6acf895dc1971a6e2aaeea0c1e0d7d8f9c1ee2
# Parent  511e1949d55708e7eeacc8ab7874df534422e4c6
extdiff: allow modifications in subrepos to be copied back

This check was a legacy bit from when the file data was being fetched manually
with 'ctx[wfn]', but archive() does that now.  49966b5ab16f seems to indicate
that this avoided a problem where a merge adds a file to another branch, and
that test still passes.

Unfortunately, I don't see a way to create a test that modifies the file in the
temporary directory before the command exits.

I wonder if the os.lstat() call needs to be wrapped in an exception handler for
the case where archive didn't create a file because the file didn't exist in
that revision.  But I wasn't able to trigger a problem without it on a real
repository.
Matt Mackall - July 29, 2015, 12:01 a.m.
On Mon, 2015-07-27 at 17:01 -0500, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison@yahoo.com>
> # Date 1438033149 14400
> #      Mon Jul 27 17:39:09 2015 -0400
> # Branch stable
> # Node ID ff6acf895dc1971a6e2aaeea0c1e0d7d8f9c1ee2
> # Parent  511e1949d55708e7eeacc8ab7874df534422e4c6
> extdiff: allow modifications in subrepos to be copied back

Queued for stable, thanks.

> Unfortunately, I don't see a way to create a test that modifies the file in the
> temporary directory before the command exits.

Point extdiff at your own "diff" script?

Patch

diff --git a/hgext/extdiff.py b/hgext/extdiff.py
--- a/hgext/extdiff.py
+++ b/hgext/extdiff.py
@@ -101,12 +101,8 @@ 
                          matchfn=scmutil.matchfiles(repo, files),
                          subrepos=listsubrepos)
 
-        ctx = repo[node]
         for fn in sorted(files):
             wfn = util.pconvert(fn)
-            if wfn not in ctx:
-                # File doesn't exist; could be a bogus modify
-                continue
             ui.note('  %s\n' % wfn)
 
             if node is None: