Patchwork [in,crew] applyupdates: assign variable before we try to use it (issue3855)

login
register
mail settings
Submitter Kevin Bullock
Date March 18, 2013, 9:42 p.m.
Message ID <0705ad73e87878304eb2.1363642967@opendoor.mincava.umn.edu>
Download mbox | patch
Permalink /patch/1137/
State Accepted
Commit 0705ad73e87878304eb21282feaf258f18cb2083
Headers show

Comments

Kevin Bullock - March 18, 2013, 9:42 p.m.
# HG changeset patch
# User Kevin Bullock <kbullock@ringworld.org>
# Date 1363642640 18000
# Node ID 0705ad73e87878304eb21282feaf258f18cb2083
# Parent  9e39a717a23e5cf91593336b5949e01cc6958a93
applyupdates: assign variable before we try to use it (issue3855)

The variable 'fd' was getting used with a value left over from a prior
iteration, causing a KeyError: '.hgsubstate'.

Patch

diff --git a/mercurial/merge.py b/mercurial/merge.py
--- a/mercurial/merge.py
+++ b/mercurial/merge.py
@@ -471,11 +471,11 @@  def applyupdates(repo, actions, wctx, mc
         f, m, args, msg = a
         progress(_updating, z + i + 1, item=f, total=numupdates, unit=_files)
         if m == "m": # merge
+            f2, fd, move = args
             if fd == '.hgsubstate': # subrepo states need updating
                 subrepo.submerge(repo, wctx, mctx, wctx.ancestor(mctx),
                                  overwrite)
                 continue
-            f2, fd, move = args
             audit(fd)
             r = ms.resolve(fd, wctx, mctx)
             if r is not None and r > 0: