Commits

Yuya Nishihara committed bb31b1b

fdfix

  • Participants
  • Parent commits 34c566d

Comments (0)

Files changed (3)

File fd-clean.diff

+# HG changeset patch
+# Date 1382623303 -32400
+# Parent a10c25b54cb3239019a9cabdbeb685d19664255e
+filedata: handle clean like modified so that size limit enforced (fixes #3425)
+
+fctx of clean file should exist, so it isn't necessary to read file-system
+directly in case of rev=None.
+
+diff --git a/tortoisehg/hgqt/filedata.py b/tortoisehg/hgqt/filedata.py
+--- a/tortoisehg/hgqt/filedata.py
++++ b/tortoisehg/hgqt/filedata.py
+@@ -402,7 +402,7 @@ class FileData(object):
+                 self.flabel += _(' <i>(was added, now missing)</i>')
+             return
+ 
+-        if status in ('I', '?', 'C'):
++        if status in ('I', '?'):
+             if ctx.rev() is None:
+                 if status in ('I', '?'):
+                     self.flabel += _(' <i>(is unversioned)</i>')
+@@ -421,7 +421,7 @@ class FileData(object):
+                 self.contents = data
+             return
+ 
+-        if status in ('M', 'A'):
++        if status in ('M', 'A', 'C'):
+             if ctx.hasStandin(wfile):
+                 wfile = ctx.findStandin(wfile)
+                 isbfile = True
+@@ -430,6 +430,9 @@ class FileData(object):
+                 return
+             fctx, newdata = res
+             self.contents = newdata
++            if status == 'C':
++                # no further comparison is necessary
++                return
+             for pctx in ctx.parents():
+                 if 'x' in fctx.flags() and 'x' not in pctx.flags(wfile):
+                     self.elabel = _("exec mode has been "
+# HG changeset patch
+# Date 1382623437 -32400
+# Parent 995645481d4970f12791da5500cdaa860c2d1a43
+filedata: remove extra code which was necessary to handle clean state
+
+diff --git a/tortoisehg/hgqt/filedata.py b/tortoisehg/hgqt/filedata.py
+--- a/tortoisehg/hgqt/filedata.py
++++ b/tortoisehg/hgqt/filedata.py
+@@ -403,18 +403,12 @@ class FileData(object):
+             return
+ 
+         if status in ('I', '?'):
+-            if ctx.rev() is None:
+-                if status in ('I', '?'):
+-                    self.flabel += _(' <i>(is unversioned)</i>')
+-                if os.path.getsize(absfile) > maxdiff:
+-                    self.error = mde
+-                    return
+-                else:
+-                    data = util.posixfile(absfile, 'r').read()
+-            elif ctx.hasStandin(wfile):
+-                data = '\0'
+-            else:
+-                data = ctx.filectx(wfile).data()
++            assert ctx.rev() is None
++            self.flabel += _(' <i>(is unversioned)</i>')
++            if os.path.getsize(absfile) > maxdiff:
++                self.error = mde
++                return
++            data = util.posixfile(absfile, 'r').read()
+             if not force and '\0' in data:
+                 self.error = 'binary file'
+             else:
+fd-clean.diff
+fd-ir.diff
 graph-index-lazyload.diff
 ci-checked.diff
 cmd-filelog.diff