Patchwork [1,of,7] transaction: accept a 'location' argument for registertmp

login
register
mail settings
Submitter Pierre-Yves David
Date Nov. 18, 2014, 11:39 p.m.
Message ID <2589c851a997c8969588.1416353998@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/6773/
State Accepted
Commit 918c77775df6ea2f09b355e1f2bd8dbfb8b237e2
Headers show

Comments

Pierre-Yves David - Nov. 18, 2014, 11:39 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1415804261 0
#      Wed Nov 12 14:57:41 2014 +0000
# Node ID 2589c851a997c896958803be48accd64ca30c674
# Parent  e63941631a3f61b3323dbcc2545689b1eb34e308
transaction: accept a 'location' argument for registertmp

This will allow generation of temporary file outside of store. This will be
useful for bookmarks.

Patch

diff --git a/mercurial/transaction.py b/mercurial/transaction.py
--- a/mercurial/transaction.py
+++ b/mercurial/transaction.py
@@ -223,17 +223,17 @@  class transaction(object):
         self._backupmap[file] = len(self._backupentries) - 1
         self._backupsfile.write("%s\0%s\0%s\0%d\n" % entry)
         self._backupsfile.flush()
 
     @active
-    def registertmp(self, tmpfile):
+    def registertmp(self, tmpfile, location=''):
         """register a temporary transaction file
 
         Such file will be delete when the transaction exit (on both failure and
         success).
         """
-        self._addbackupentry(('', '', tmpfile, False))
+        self._addbackupentry((location, '', tmpfile, False))
 
     @active
     def addfilegenerator(self, genid, filenames, genfunc, order=0,
                          location=''):
         """add a function to generates some files at transaction commit