Changeset b2c2e4084c92…
Parent 4cd330d3188f…
by
Changes to one file · Browse files at b2c2e4084c92 Showing diff from parent 4cd330d3188f Diff from another changeset...
@@ -10,6 +10,8 @@
import os
import sys
+import shutil
+import tempfile
from PyQt4.QtCore import *
@@ -479,6 +481,16 @@ # data in the repository
self.thginvalidate()
+ def thgbackup(self, path):
+ 'Make a backup of the given file in the repository "trashcan"'
+ trashcan = self.join('Trashcan')
+ if not os.path.isdir(trashcan):
+ os.mkdir(trashcan)
+ name = os.path.basename(path)
+ root, ext = os.path.splitext(name)
+ dest = tempfile.mktemp(ext, root, trashcan)
+ shutil.copyfile(path, dest)
+
return thgrepository
|
Loading...