Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.7, 0.7.1, and 0.7.2

commit: skip record process for "clean" commits

If the user has not rejected any of the change hunks for the file, do not
subject it to the backup-revert-patch-commit-recover cycle that record
normally does for all modified files, simply commit it.

We do this in TortoiseHg because it decreases the chance of the cycle
failing when a soure file has been locked by another application, a
Windows specific problem.

Changeset 329711fe3570

Parent e4c311c52ba4

by Steve Borho

Changes to one file · Browse files at 329711fe3570 Showing diff from parent e4c311c52ba4 Diff from another changeset...

Change 1 of 2 Show Entire File hggtk/​commit.py Stacked
 
294
295
296
 
 
297
298
299
 
300
301
302
 
311
312
313
314
315
316
 
 
 
 
 
317
318
319
 
294
295
296
297
298
299
 
 
300
301
302
303
 
312
313
314
 
 
315
316
317
318
319
320
321
322
323
@@ -294,9 +294,10 @@
  def _commit_selected(self, files):   import hgshelve   # 1a. get list of chunks not rejected + repo, chunks, ui = self.repo, self._shelve_chunks, self.ui + model = self.diff_model   files = [util.pconvert(f) for f in files] - hlist = [x[DM_CHUNK_ID] for x in self.diff_model if not x[DM_REJECTED]] - repo, chunks, ui = self.repo, self._shelve_chunks, self.ui + hlist = [x[DM_CHUNK_ID] for x in model if not x[DM_REJECTED]]     # 2. backup changed files, so we can restore them in the end   backups = {} @@ -311,9 +312,12 @@
  try:   # backup continues   for f in files: - if f not in self._filechunks: continue - if len(self._filechunks[f]) == 1: continue   if f not in self.modified: continue + fh = self._filechunks.get(f) + if not fh or len(fh) < 2: continue + # unfiltered files do not go through backup-revert-patch cycle + rejected = [x for x in fh[1:] if model[x][DM_REJECTED]] + if len(rejected) == 0: continue   fd, tmpname = tempfile.mkstemp(prefix=f.replace('/', '_')+'.',   dir=backupdir)   os.close(fd)