[PATCH 1 of 7 🚂] transaction: drop the third item in `tr.backupentries`

Pierre-Yves David pierre-yves.david at ens-lyon.org
Mon Nov 10 10:31:46 CST 2014


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1415151196 0
#      Wed Nov 05 01:33:16 2014 +0000
# Node ID 589d7454fba619ad9db81552941ed5cdefebf19e
# Parent  fd24dc73428037b74a7ada3f704b94f0573ab50f
transaction: drop the third item in `tr.backupentries`

This third item is always None and never used.

diff --git a/mercurial/transaction.py b/mercurial/transaction.py
--- a/mercurial/transaction.py
+++ b/mercurial/transaction.py
@@ -41,11 +41,11 @@ def _playback(journal, report, opener, e
             except (IOError, OSError), inst:
                 if inst.errno != errno.ENOENT:
                     raise
 
     backupfiles = []
-    for f, b, _ignore in backupentries:
+    for f, b in backupentries:
         filepath = opener.join(f)
         backuppath = opener.join(b)
         try:
             util.copyfile(backuppath, filepath)
             backupfiles.append(b)
@@ -127,11 +127,11 @@ class transaction(object):
         offsets = []
         backups = []
         for f, o, _data in q[0]:
             offsets.append((f, o))
 
-        for f, b, _data in q[1]:
+        for f, b in q[1]:
             backups.append((f, b))
 
         d = ''.join(['%s\0%d\n' % (f, o) for f, o in offsets])
         self.file.write(d)
         self.file.flush()
@@ -181,11 +181,11 @@ class transaction(object):
 
         if self._queue:
             self._queue[-1][1].append((file, backupfile))
             return
 
-        self.backupentries.append((file, backupfile, None))
+        self.backupentries.append((file, backupfile))
         self.backupmap[file] = len(self.backupentries) - 1
         self.backupsfile.write("%s\0%s\n" % (file, backupfile))
         self.backupsfile.flush()
 
     @active
@@ -329,11 +329,11 @@ class transaction(object):
             self.after()
         if self.opener.isfile(self.journal):
             self.opener.unlink(self.journal)
         if self.opener.isfile(self.backupjournal):
             self.opener.unlink(self.backupjournal)
-            for _f, b, _ignore in self.backupentries:
+            for _f, b in self.backupentries:
                 self.opener.unlink(b)
         self.backupentries = []
         self.journal = None
         # run post close action
         categories = sorted(self._postclosecallback)
@@ -411,11 +411,11 @@ def rollback(opener, file, report):
                 for line in lines[1:]:
                     if line:
                         # Shave off the trailing newline
                         line = line[:-1]
                         f, b = line.split('\0')
-                        backupentries.append((f, b, None))
+                        backupentries.append((f, b))
             else:
                 report(_("journal was created by a newer version of "
                          "Mercurial"))
 
     _playback(file, report, opener, entries, backupentries)


More information about the Mercurial-devel mailing list