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

shelve: deleting chunks from patches mostly works

Currently no way to delete a file when it has no chunks, after asking for its
header to be kept. And the context menu in general for the file list is mostly
innapropriate. The same is true of revdetails in the workbench when displaying
the working directory or an unapplied patch.

Changeset ba3bbb597b04

Parent 14e176304db2

by Steve Borho

Changes to 3 files · Browse files at ba3bbb597b04 Showing diff from parent 14e176304db2 Diff from another changeset...

 
110
111
112
113
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
115
116
 
148
149
150
151
 
 
 
152
153
154
 
351
352
353
354
 
355
356
357
 
110
111
112
 
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
 
168
169
170
 
171
172
173
174
175
176
 
373
374
375
 
376
377
378
379
@@ -110,7 +110,27 @@
  revertall = True   ctx = self.filelistmodel._ctx   if isinstance(ctx, patchctx): - raise 'unimplemented' + try: + fp = util.atomictempfile(ctx._path, 'wb') + if ctx._ph.comments: + fp.write('\n'.join(ctx._ph.comments)) + fp.write('\n\n') + for wfile in ctx._fileorder: + if wfile == self.currentFile: + if revertall: + continue + chunks[0].write(fp) + for chunk in kchunks: + chunk.write(fp) + if not chunks[-1].selected: + fp.write('\n') + else: + for chunk in ctx._files[wfile]: + chunk.write(fp) + fp.rename() + finally: + del fp + self.fileModified.emit()   else:   path = repo.wjoin(self.currentFile)   if not os.path.exists(path): @@ -148,7 +168,9 @@
  def displayFile(self, file, rev, status):   if file:   self.currentFile = file - self.mtime = os.path.getmtime(self.repo.wjoin(file)) + path = self.repo.wjoin(file) + if os.path.exists(path): + self.mtime = os.path.getmtime(path)   self.diffbrowse.displayFile(file, status)   self.fileSelected.emit(True)   else: @@ -351,7 +373,7 @@
  chunks = self._ctx._files[filename]   else:   buf = cStringIO.StringIO() - buf.write('diff -r XX %s\n' % filename) + buf.write('diff -r aaaaaaaaaaaa -r bbbbbbbbbbb %s\n' % filename)   buf.write('\n'.join(fd.diff))   buf.seek(0)   chunks = record.parsepatch(buf)
 
236
237
238
 
 
239
240
241
 
254
255
256
257
 
258
259
 
260
261
262
 
 
 
 
 
 
 
263
264
265
266
267
 
 
 
 
 
 
 
 
268
269
270
 
236
237
238
239
240
241
242
243
 
256
257
258
 
259
260
 
261
262
 
 
263
264
265
266
267
268
269
270
 
 
 
 
271
272
273
274
275
276
277
278
279
280
281
@@ -236,6 +236,8 @@
  @pyqtSlot()   def refreshCombos(self):   shelvea, shelveb = self.currentPatchA(), self.currentPatchB() + oldidxa = self.comboa.currentIndex() + oldidxb = self.comboa.currentIndex()     shelves = self.repo.thgshelves()   disp = [_('Shelf: %s') % hglib.tounicode(s) for s in shelves] @@ -254,17 +256,26 @@
    # attempt to restore selection   if shelvea == self.wdir: - self.comboa.setCurrentIndex(0) + idx = 0   elif shelvea in self.shelves: - self.comboa.setCurrentIndex(1 + self.shelves.index(shelvea)) + idx = self.shelves.index(shelvea) + 1   elif shelvea in self.patches: - self.comboa.setCurrentIndex(1 + len(self.shelves) + - self.patches.index(shelvea)) + idx = len(self.shelves) + self.patches.index(shelvea) + 1 + else: + idx = 0 + self.comboa.setCurrentIndex(idx) + if idx == oldidxa: + self.comboAChanged(idx) +   if shelveb in self.shelves: - self.combob.setCurrentIndex(self.shelves.index(shelveb)) - if shelveb in self.shelves: - self.combob.setCurrentIndex(len(self.shelves) + - self.patches.index(shelveb)) + idx = self.shelves.index(shelveb) + elif shelveb in self.patches: + idx = len(self.shelves) + self.patches.index(shelveb) + else: + idx = 0 + self.combob.setCurrentIndex(idx) + if idx == oldidxb: + self.comboBChanged(idx)   if not patches and not shelves:   self.delShelfButtonB.setEnabled(False)   self.browseb.setContext(patchctx('', self.repo, None))
 
32
33
34
 
35
36
37
 
166
167
168
 
169
170
171
 
32
33
34
35
36
37
38
 
167
168
169
170
171
172
173
@@ -32,6 +32,7 @@
  self._repo = repo   self._rev = rev   self._status = [[], [], []] + self._fileorder = []   self._user = ''   self._date = ''   self._desc = '' @@ -166,6 +167,7 @@
  if path not in files:   self._status[type].append(path)   files[path] = [chunk] + self._fileorder.append(path)   else:   files[path].append(chunk)   except patch.PatchError: