Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9.2, 1.9.3, and 2.0

thgrepo: introduce therepo.thgbackup()

Creates a Trashcan folder under .hg/ for backing up files that are being
modfied by the shelve tool and potentially other tools. Users can find old
versions of files there based on the timestamp. The purge tool will support
clearing the trashcan.

Changeset b2c2e4084c92

Parent 4cd330d3188f

by Steve Borho

Changes to one file · Browse files at b2c2e4084c92 Showing diff from parent 4cd330d3188f Diff from another changeset...

 
10
11
12
 
 
13
14
15
 
479
480
481
 
 
 
 
 
 
 
 
 
 
482
483
484
 
10
11
12
13
14
15
16
17
 
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
@@ -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