On Thu, Apr 2, 2009 at 12:38 AM, Trent W. Buck <trentb...@gmail.com> wrote: > On Wed, Apr 01, 2009 at 10:08:32PM +0200, Vincent Legoll wrote: >> I don't understand your patch, my mercurial outputs >> >> diff -r 75ef8a4a74ad testdir/testsubdir/testsubdir.txt >> >> and not "diff --git" > > OK, perhaps it is because my .hgrc contains > > [diff] > git = True > > ...because that's what I like on the command line, and meld doesn't > understand to turn that off when it uses mercurial for its own > purposes.
OK, I wasn't aware of that hg diff mode. But why turn it off when we can handle it properly ? ;-) Could you also try the attached patch (which is against r1312) it tries to handle both hg diff modes. I tested it on hg standard & git modes + svn (for non regression) -- Vincent Legoll
Index: vc/mercurial.py =================================================================== --- vc/mercurial.py (revision 1312) +++ vc/mercurial.py (working copy) @@ -31,7 +31,8 @@ NAME = "Mercurial" VC_DIR = ".hg" PATCH_STRIP_NUM = 1 - PATCH_INDEX_RE = "^diff -r \w+ (.*)$" + # Mercurial diff can be run in "git" mode + PATCH_INDEX_RE = "^(?:diff -r \w+ (.*))|(?:diff --git a/(.*) b/.*)$" def commit_command(self, message): return [self.CMD,"commit","-m",message] Index: vc/_vc.py =================================================================== --- vc/_vc.py (revision 1312) +++ vc/_vc.py (working copy) @@ -111,7 +111,14 @@ def get_patch_files(self, patch): regex = re.compile(self.PATCH_INDEX_RE, re.M) - return [f.strip() for f in regex.findall(patch)] + def pick(f): + if isinstance(f, str): + return f + for item in f: + if item: + return item + return None + return [pick(f).strip() for f in regex.findall(patch)] def listdir_filter(self, entries): return [f for f in entries if f != self.VC_DIR]