GNOME Bugzilla – Bug 447582
Mercurial VC plugin error: "hg diff --git"
Last modified: 2009-04-11 22:54:26 UTC
[from http://bugs.debian.org/428843] When trying to compare files managed with mercurial, meld issues the following error message: Could not read from '/bc/w/eagle.work/-r d1406689352c daemon/src/global.h' The error was: [Errno 2] No such file or directory: '/bc/w/eagle.work/-r d1406689352c daemon/src/global.h' Instead of comparing the local file with the version it has correctly extracted in : /tmp/tmpVoVDza-meld/-r\ d1406689352c\ daemon/src/global.h meld does the comparison with a local inexistent file. meld is using the current directory instead of the temporary generated one in /tmp/tmpVoVDza-meld when it tries to open the file.
Looks like the mercurial flags or patch format has changed again :( I haven't looked yet, but it's likely that PATCH_INDEX_RE needs to be updated.
PATCH_INDEX_RE has been updated so normal diffs work. New files still generate a warning about not being able to read the nonexistant "patched file".
Hello, Problem still exist for meld version 1.2.1 which does not work with mercurial version 1.0.1. The following simple patch corrects the issue: --- vc/mercurial.py.org 2008-12-17 16:56:11.000000000 +0100 +++ vc/mercurial.py 2008-12-17 16:56:24.000000000 +0100 @@ -30,7 +30,7 @@ CMD = "hg" NAME = "Mercurial" PATCH_STRIP_NUM = 1 - PATCH_INDEX_RE = "^diff -r \w+ (.*)$" + PATCH_INDEX_RE = "^diff --git a/(.*) b/.*$" def __init__(self, location): while location != "/": Seems mercurial now decided to use the same format as git. Should be easier for the future.
Stupid me, seems this is not the default behavior of mercurial, but is due to the fact that my .hgrc contains: [diff] git = True So the code must be a little more clever to cope with this.
Hello, A patch that works for me, whatever mercurial configuration I use: --- meld-1.2.1.org/vcview.py 2008-10-02 23:34:54.000000000 +0200 +++ meld-1.2.1/vcview.py 2008-12-18 16:50:58.000000000 +0100 @@ -435,10 +435,12 @@ tmpdir = tempfile.mkdtemp("-meld") self.tempdirs.append(tmpdir) + self.vc.PATCH_INDEX_RE = r"^diff (?:--git|-r) .+ (.+)$" regex = re.compile(self.vc.PATCH_INDEX_RE, re.M) files = [f.strip() for f in regex.findall(patch)] diffs = [] for fname in files: + fname = fname.split('/')[-1] destfile = os.path.join(tmpdir,fname) destdir = os.path.dirname( destfile ) The REGEX should indeed go into meld-1.2.1/vc/mercurial.py Best regards.
Created attachment 132103 [details] [review] slightly different implementation, allow to easily test
r1342