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

shelve: automatically create a new shelf when required

Changeset 0a45ee231e32

Parent 296d0d39d343

by Steve Borho

Changes to one file · Browse files at 0a45ee231e32 Showing diff from parent 296d0d39d343 Diff from another changeset...

 
94
95
96
97
 
98
99
100
 
168
169
170
 
 
171
172
173
 
182
183
184
 
 
185
186
187
 
196
197
198
 
 
199
200
201
 
207
208
209
210
211
212
213
214
215
216
217
218
 
 
 
 
 
 
 
 
 
 
 
 
 
 
219
220
221
 
94
95
96
 
97
98
99
100
 
168
169
170
171
172
173
174
175
 
184
185
186
187
188
189
190
191
 
200
201
202
203
204
205
206
207
 
213
214
215
 
 
 
 
 
 
 
 
 
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
@@ -94,7 +94,7 @@
  self.rbar.addAction(self.refreshAction)   self.actionNew = a = QAction(_('New Shelf'), self)   a.setIcon(qtlib.geticon('document-new')) - a.triggered.connect(self.newShelf) + a.triggered.connect(self.newShelfPressed)   self.rbar.addAction(self.actionNew)     self.lefttbar = QToolBar(_('Left Toolbar'), objectName='lefttbar') @@ -168,6 +168,8 @@
    @pyqtSlot()   def moveFileRight(self): + if self.combob.currentIndex() == -1: + self.newShelf(False)   file, _ = self.browsea.getSelectedFileAndChunks()   chunks = self.browsea.getChunksForFile(file)   if self.browseb.mergeChunks(file, chunks): @@ -182,6 +184,8 @@
    @pyqtSlot()   def moveFilesRight(self): + if self.combob.currentIndex() == -1: + self.newShelf(False)   for file in self.browsea.getFileList():   chunks = self.browsea.getChunksForFile(file)   if self.browseb.mergeChunks(file, chunks): @@ -196,6 +200,8 @@
    @pyqtSlot()   def moveChunksRight(self): + if self.combob.currentIndex() == -1: + self.newShelf(False)   file, chunks = self.browsea.getSelectedFileAndChunks()   if self.browseb.mergeChunks(file, chunks):   self.browsea.deleteSelectedChunks() @@ -207,15 +213,20 @@
  self.browseb.deleteSelectedChunks()     @pyqtSlot() - def newShelf(self): - dlg = QInputDialog(self, Qt.Sheet) - dlg.setWindowModality(Qt.WindowModal) - dlg.setWindowTitle(_('TortoiseHg New Shelf Name')) - dlg.setLabelText(_('Specify name of new shelf')) - dlg.setTextValue(time.strftime('%Y-%m-%d_%H-%M-%S')) - if not dlg.exec_(): - return - shelve = hglib.fromunicode(dlg.textValue()) + def newShelfPressed(self): + self.newShelf(True) + + def newShelf(self, interactive): + shelve = time.strftime('%Y-%m-%d_%H-%M-%S') + if interactive: + dlg = QInputDialog(self, Qt.Sheet) + dlg.setWindowModality(Qt.WindowModal) + dlg.setWindowTitle(_('TortoiseHg New Shelf Name')) + dlg.setLabelText(_('Specify name of new shelf')) + dlg.setTextValue(shelve) + if not dlg.exec_(): + return + shelve = hglib.fromunicode(dlg.textValue())   try:   fn = os.path.join('shelves', shelve)   shelfpath = self.repo.join(fn)