[PATCH 5 of 7] patch: minor cleanup of _applydiff
Mads Kiilerich
mads at kiilerich.com
Mon Apr 26 07:37:56 CDT 2010
# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1272280863 -7200
# Node ID 9531f5c39c0732ac451c9c191340b99455569401
# Parent 50c548cc4249b964cb5012307389f57377ea8149
patch: minor cleanup of _applydiff
diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -1130,8 +1130,8 @@
rejects = 0
err = 0
current_file = None
- gitpatches = None
- opener = util.opener(os.getcwd())
+ cwd = os.getcwd()
+ opener = util.opener(cwd)
def closefile():
if not current_file:
@@ -1143,8 +1143,7 @@
if state == 'hunk':
if not current_file:
continue
- current_hunk = values
- ret = current_file.apply(current_hunk)
+ ret = current_file.apply(values)
if ret >= 0:
changed.setdefault(current_file.fname, None)
if ret > 0:
@@ -1163,13 +1162,11 @@
missing=missing, eolmode=eolmode)
except PatchError, err:
ui.warn(str(err) + '\n')
- current_file, current_hunk = None, None
+ current_file = None
rejects += 1
continue
elif state == 'git':
- gitpatches = values
- cwd = os.getcwd()
- for gp in gitpatches:
+ for gp in values:
if gp.op in ('COPY', 'RENAME'):
copyfn(gp.oldpath, gp.path, cwd)
changed[gp.path] = gp
More information about the Mercurial-devel
mailing list