# HG changeset patch # User Mads Kiilerich # Date 1272280863 -7200 # Node ID c47a1cfad57215d88153b7d90b341e8d87252cc2 # Parent dd157720a8ee89708ca187d2ea3a48f633c72f7d patch: minor cleanup of _applydiff diff -r dd157720a8ee -r c47a1cfad572 mercurial/patch.py --- a/mercurial/patch.py Mon Apr 26 13:21:02 2010 +0200 +++ b/mercurial/patch.py Mon Apr 26 13:21:03 2010 +0200 @@ -1153,8 +1153,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: @@ -1166,8 +1166,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: @@ -1186,13 +1185,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