Patchwork largefiles: don't query the dirstate for key None

login
register
mail settings
Submitter Siddharth Agarwal
Date March 19, 2013, 8:53 p.m.
Message ID <19731e3cad1ae91d96da.1363726385@sid0x220>
Download mbox | patch
Permalink /patch/1138/
State Accepted
Commit a1279893872194de7205bf34ef06fa74cf7ee3e7
Headers show

Comments

Siddharth Agarwal - March 19, 2013, 8:53 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1363726174 25200
#      Tue Mar 19 13:49:34 2013 -0700
# Node ID 19731e3cad1ae91d96da4a49994e94ab3b157850
# Parent  e501e6c715b1c2a12ef151d4811b04afdb483527
largefiles: don't query the dirstate for key None

lfutil.splitstandin(f) can be None, and we query the dirstate for that without
checking if it is. This will cause problems with the upcoming move to critbit-
based dicts, since they only support strings as keys.

Patch

diff --git a/hgext/largefiles/overrides.py b/hgext/largefiles/overrides.py
--- a/hgext/largefiles/overrides.py
+++ b/hgext/largefiles/overrides.py
@@ -373,10 +373,13 @@  def overridemanifestmerge(origfn, repo, 
         f, m, args, msg = action
 
         choices = (_('&Largefile'), _('&Normal file'))
-        if m == "g" and lfutil.splitstandin(f) in p1 and f in p2:
+
+        splitstandin = lfutil.splitstandin(f)
+        if (m == "g" and splitstandin is not None and
+            splitstandin in p1 and f in p2):
             # Case 1: normal file in the working copy, largefile in
             # the second parent
-            lfile = lfutil.splitstandin(f)
+            lfile = splitstandin
             standin = f
             msg = _('%s has been turned into a largefile\n'
                     'use (l)argefile or keep as (n)ormal file?') % lfile