Changeset 9152f172c504…
Parent d81235b13f08…
by
Changes to 3 files · Browse files at 9152f172c504 Showing diff from parent d81235b13f08 Diff from another changeset...
@@ -325,7 +325,8 @@ opts=diffopts):
buf.write(p)
buf.seek(0)
- return record.parsepatch(buf)
+ header = record.parsepatch(buf)[0]
+ return [header] + header.hunks
@pyqtSlot(object, object, object)
def displayFile(self, file, rev, status):
@@ -566,7 +567,8 @@ elif type(self._ctx.rev()) is str:
chunks = self._ctx._files[filename]
else:
- chunks = record.parsepatch(cStringIO.StringIO(fd.diff))
+ header = record.parsepatch(cStringIO.StringIO(fd.diff))[0]
+ chunks = [header] + header.hunks
utext = []
for chunk in chunks[1:]:
|
@@ -103,7 +103,8 @@ except IOError, e:
pass
try:
- self.chunks = record.parsepatch(buf)[1:]
+ header = record.parsepatch(buf)[0]
+ self.chunks = header.hunks
except patch.PatchError, e:
self.chunks = []
|
@@ -39,6 +39,7 @@ self._branch = ''
self._node = node.nullid
self._mtime = None
+ self._parseerror = None
try:
ph = mq.patchheader(self._path)
@@ -164,20 +165,22 @@ for i in range(self._ph.diffstartline):
pf.readline()
for chunk in record.parsepatch(pf):
- if isinstance(chunk, record.header):
- top = patch.parsefilename(chunk.header[-2])
- bot = patch.parsefilename(chunk.header[-1])
- type, path = get_path(top, bot)
- if path not in chunk.files():
- type, path = 0, chunk.files()[-1]
- if path not in files:
- self._status[type].append(path)
- files[path] = [chunk]
- self._fileorder.append(path)
- else:
- files[path].append(chunk)
- except patch.PatchError:
- pass
+ if not isinstance(chunk, record.header):
+ continue
+ top = patch.parsefilename(chunk.header[-2])
+ bot = patch.parsefilename(chunk.header[-1])
+ type, path = get_path(top, bot)
+ if path not in chunk.files():
+ type, path = 0, chunk.files()[-1]
+ if path not in files:
+ self._status[type].append(path)
+ files[path] = [chunk]
+ self._fileorder.append(path)
+ files[path].extend(chunk.hunks)
+ except patch.PatchError, e:
+ self._parseerror = e
+ if 'THGDEBUG' in os.environ:
+ print e
finally:
pf.close()
return files
|
Loading...