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

commit: implement branch change operations

In an improvement over the GTK branch, allow commit to continue even
if wctx.branch() change was done by another application.

Changeset 87a4c97bc4fd

Parent 7f60402257e8

by Steve Borho

Changes to one file · Browse files at 87a4c97bc4fd Showing diff from parent 7f60402257e8 Diff from another changeset...

 
21
22
23
 
24
25
26
 
245
246
247
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
248
249
 
250
251
252
 
285
286
287
288
 
 
289
290
291
 
21
22
23
24
25
26
27
 
246
247
248
249
250
251
252
253
254
255
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
282
283
 
284
285
286
287
 
320
321
322
 
323
324
325
326
327
@@ -21,6 +21,7 @@
 # qrefresh support  # threaded / wrapped commit (need a CmdRunner equivalent)  # qctlib decode failure dialog (ask for retry locale, suggest HGENCODING) +# Need a unicode-to-UTF8 function  # +1 / -1 head indication (not as important with workbench integration)  # recent committers history  # pushafterci, autoincludes list @@ -245,8 +246,42 @@
  parent=self)   self.msgte.setFocus()   return + repo = self.stwidget.repo + if self.branchop is None: + brcmd = [] + elif self.branchop == False: + brcmd = ['--close-branch'] + else: + brcmd = [] + # TODO: Need a unicode-to-UTF8 function + newbranch = hglib.fromunicode(self.branchop) + if newbranch in repo.branchtags(): + # response: 0=Yes, 1=No, 2=Cancel + pb = [p.branch() for p in repo.parents()] + if self.nextbranch in pb: + resp = 0 + else: + rev = repo[newbranch].rev() + resp = qtlib.CustomPrompt(_('Confirm Branch Change'), + _('Named branch "%s" already exists, ' + 'last used in revision %d\n' + 'Yes\t- Make commit restarting this named branch\n' + 'No\t- Make commit without changing branch\n' + 'Cancel\t- Cancel this commit') % (newbranch, rev), + self, (_('&Yes'), _('&No'), _('&Cancel')), 2, 2).run() + else: + resp = qtlib.CustomPrompt(_('Confirm New Branch'), + _('Create new named branch "%s" with this commit?\n' + 'Yes\t- Start new branch with this commit\n' + 'No\t- Make commit without branch change\n' + 'Cancel\t- Cancel this commit') % newbranch, + self, (_('&Yes'), _('&No'), _('&Cancel')), 2, 2).run() + if resp == 0: + repo.dirstate.setbranch(newbranch) + elif resp == 2: + return   files = self.stwidget.getChecked('MAR?!S') - if not files: + if not (files or brcmd or repo[None].branch() != repo['.'].branch()):   qtlib.WarningMsgBox(_('No files checked'),   _('No modified files checkmarked for commit'),   parent=self) @@ -285,7 +320,8 @@
  dispatch._dispatch(ui, ['remove'] + checkedMissing)   else:   return - cmdline = ['commit', '--user', user, '--message', msg] + files + cmdline = ['commit', '--user', user, '--message', msg] + cmdline += brcmd + files   ret = dispatch._dispatch(ui, cmdline)   if not ret:   self.addMessageToHistory()