[PATCH STABLE] transaction: use the proper variable in '_addbackupentry' (issue4684)

Paul Sargent psarge at gmail.com
Sat May 23 05:11:56 CDT 2015


Sorry (especially on a first post to the list), but this fix looks wrong to me. Since reporting it, I’ve been trying to work out what the intention was a bit more. 

    diff --git a/mercurial/transaction.py b/mercurial/transaction.py
    --- a/mercurial/transaction.py
    +++ b/mercurial/transaction.py
    @@ -220,11 +220,11 @@ class transaction(object):
             self._addbackupentry((location, file, backupfile, False))
 
         def _addbackupentry(self, entry):
             """register a new backup entry and write it to disk"""
             self._backupentries.append(entry)
    -        self._backupmap[file] = len(self._backupentries) - 1
    +        self._backupmap[entry] = len(self._backupentries) - 1
             self._backupsfile.write("%s\0%s\0%s\0%d\n" % entry)
             self._backupsfile.flush()
 
We can see from the first line that ‘entry' is a tuple when called, which contains something called ‘file’ (which I think is a string containing a path). This function used was refactored out of the end of the previous one, so I think it’s safe to say ‘file’ should be replaced with the second member of ‘entry’, not ‘entry’ itself.

I still have no clue what the structure that’s created is used for though. Doesn’t seem to have caused many issues being busted.

Paul






More information about the Mercurial-devel mailing list