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

chunks: properly revert files that are in Added or Removed state

Changeset 9983eeadcd02

Parent 34bbbcb60525

by Steve Borho

Changes to one file · Browse files at 9983eeadcd02 Showing diff from parent 34bbbcb60525 Diff from another changeset...

 
8
9
10
11
 
12
13
14
 
196
197
198
199
200
201
202
203
204
205
 
 
 
 
 
 
206
207
208
 
211
212
213
214
215
 
 
216
217
218
 
308
309
310
311
312
313
314
315
316
 
317
318
319
 
8
9
10
 
11
12
13
14
 
196
197
198
 
 
 
 
 
 
 
199
200
201
202
203
204
205
206
207
 
210
211
212
 
 
213
214
215
216
217
 
307
308
309
 
 
 
 
 
 
310
311
312
313
@@ -8,7 +8,7 @@
 import cStringIO  import os   -from mercurial import hg, util, patch +from mercurial import hg, util, patch, commands  from mercurial import match as matchmod, ui as uimod  from hgext import record   @@ -196,13 +196,12 @@
  if self.mtime != os.path.getmtime(path):   self.showMessage.emit(_('file has been modified, refresh'))   return - repo.thgbackup(repo.wjoin(self.currentFile)) - wlock = repo.wlock() - try: - if revertall: - hg.revert(repo, repo.dirstate.parents()[0], - lambda a: a == self.currentFile) - else: + repo.thgbackup(path) + if revertall: + commands.revert(repo.ui, repo, path) + else: + wlock = repo.wlock() + try:   repo.wopener(self.currentFile, 'wb').write(   self.diffbrowse.origcontents)   fp = cStringIO.StringIO() @@ -211,8 +210,8 @@
  c.write(fp)   fp.seek(0)   self.runPatcher(fp, self.currentFile, False) - finally: - wlock.release() + finally: + wlock.release()   self.fileModified.emit()     def mergeChunks(self, wfile, chunks): @@ -308,12 +307,7 @@
  ctx.invalidate()   else:   repo.thgbackup(repo.wjoin(wfile)) - try: - wlock = repo.wlock() - hg.revert(repo, repo.dirstate.parents()[0], - lambda a: a == wfile) - finally: - wlock.release() + commands.revert(repo.ui, repo, repo.wjoin(wfile))   self.fileModified.emit()     def getChunksForFile(self, wfile):