def validatePage(self): if self.cmd.core.running(): return False if len(self.repo.parents()) == 1: # commit succeeded, repositoryChanged() called wizard().next() if self.skiplast.isChecked(): self.wizard().close() return True user = qtlib.getCurrentUsername(self, self.repo) if not user: return False self.setTitle(_('Committing...')) self.setSubTitle(_('Please wait while committing merged files.')) message = hglib.fromunicode(self.msgEntry.text()) cmdline = ['commit', '--verbose', '--message', message, '--repository', self.repo.root, '--user', user] commandlines = [cmdline] pushafter = self.repo.ui.config('tortoisehg', 'cipushafter') if pushafter: cmd = ['push', '--repository', self.repo.root, pushafter] commandlines.append(cmd) self.repo.incrementBusyCount() self.cmd.setShowOutput(True) self.cmd.run(*commandlines) return False
def validatePage(self): if not self._cmdsession.isFinished(): return False if len(self.repo[None].parents()) == 1: # commit succeeded, repositoryChanged() called wizard().next() if self.field('skiplast').toBool(): self.wizard().close() return True user = hglib.tounicode(qtlib.getCurrentUsername(self, self.repo, self.opts)) if not user: return False self.setTitle(_('Committing...')) self.setSubTitle(_('Please wait while committing merged files.')) opts = {'verbose': True, 'message': self.msgEntry.text(), 'user': user, 'subrepos': bool(self.opts.get('recurseinsubrepos')), 'date': hglib.tounicode(self.opts.get('date')), } commandlines = [hglib.buildcmdargs('commit', **opts)] pushafter = self.repo.ui.config('tortoisehg', 'cipushafter') if pushafter: cmd = ['push', hglib.tounicode(pushafter)] commandlines.append(cmd) self._cmdlog.show() sess = self._repoagent.runCommandSequence(commandlines, self) self._cmdsession = sess sess.commandFinished.connect(self.onCommandFinished) sess.outputReceived.connect(self._cmdlog.appendLog) return False
def validatePage(self): if self.cmd.core.running(): return False if len(self.repo.parents()) == 1: # commit succeeded, repositoryChanged() called wizard().next() if self.skiplast.isChecked(): self.wizard().close() return True user = qtlib.getCurrentUsername(self, self.repo) if not user: return False self.setTitle(_('Committing...')) self.setSubTitle(_('Please wait while committing merged files.')) message = hglib.fromunicode(self.msgEntry.text()) cmdline = [ 'commit', '--verbose', '--message', message, '--repository', self.repo.root, '--user', user ] commandlines = [cmdline] pushafter = self.repo.ui.config('tortoisehg', 'cipushafter') if pushafter: cmd = ['push', '--repository', self.repo.root, pushafter] commandlines.append(cmd) self.repo.incrementBusyCount() self.cmd.setShowOutput(True) self.cmd.run(*commandlines) return False
def onAddTag(self): if self.cmd.core.running(): self.set_status(_("Repository command still running"), False) return tagu = self.tagCombo.currentText() tag = hglib.fromunicode(tagu) local = self.localCheckBox.isChecked() force = self.replaceCheckBox.isChecked() english = self.englishCheckBox.isChecked() if self.customCheckBox.isChecked(): message = self.customTextLineEdit.text() else: message = None exists = tag in self.repo.tags() if exists and not force: self.set_status(_("Tag '%s' already exists") % tagu, False) return if not local: parents = self.repo.parents() if len(parents) > 1: self.set_status(_("uncommitted merge"), False) return p1 = parents[0] if not force and p1.node() not in self.repo._branchheads: self.set_status(_("not at a branch head (use force)"), False) return if not message: ctx = self.repo[self.rev] if exists: origctx = self.repo[self.repo.tags()[tag]] msgset = keep._("Moved tag %s to changeset %s" " (from changeset %s)") message = (english and msgset["id"] or msgset["str"]) % (tagu, str(ctx), str(origctx)) else: msgset = keep._("Added tag %s for changeset %s") message = (english and msgset["id"] or msgset["str"]) % (tagu, str(ctx)) message = hglib.fromunicode(message) def finished(): if exists: self.set_status(_("Tag '%s' has been moved") % tagu, True) else: self.set_status(_("Tag '%s' has been added") % tagu, True) user = qtlib.getCurrentUsername(self, self.repo) if not user: return cmd = ["tag", "--repository", self.repo.root, "--rev", str(self.rev), "--user", user] if local: cmd.append("--local") else: cmd.append("--message=%s" % message) if force: cmd.append("--force") cmd.append(tag) self.finishfunc = finished self.cmd.run(cmd)
def onAddTag(self): tagu = self.tagCombo.currentText() tag = hglib.fromunicode(tagu) local = self.localCheckBox.isChecked() force = self.replaceCheckBox.isChecked() english = self.englishCheckBox.isChecked() if self.customCheckBox.isChecked(): message = self.customTextLineEdit.text() else: message = None exists = tag in self.repo.tags() if exists and not force: self.set_status(_("Tag '%s' already exists") % tagu, False) return if not local: parents = self.repo.parents() if len(parents) > 1: self.set_status(_('uncommitted merge'), False) return p1 = parents[0] if not force and p1.node() not in self.repo._branchheads: self.set_status(_('not at a branch head (use force)'), False) return if not message: ctx = self.repo[self.rev] if exists: origctx = self.repo[self.repo.tags()[tag]] msgset = keep._('Moved tag %s to changeset %s' \ ' (from changeset %s)') message = (english and msgset['id'] or msgset['str']) \ % (tagu, str(ctx), str(origctx)) else: msgset = keep._('Added tag %s for changeset %s') message = (english and msgset['id'] or msgset['str']) \ % (tagu, str(ctx)) message = hglib.fromunicode(message) def finished(): if exists: self.set_status(_("Tag '%s' has been moved") % tagu, True) else: self.set_status(_("Tag '%s' has been added") % tagu, True) user = qtlib.getCurrentUsername(self, self.repo) if not user: return cmd = ['tag', '--repository', self.repo.root, '--rev', str(self.rev), '--user', user] if local: cmd.append('--local') else: cmd.append('--message=%s' % message) if force: cmd.append('--force') cmd.append(tag) self.finishfunc = finished self.cmd.run(cmd)
def rowDoubleClicked(self, index): wfile, user, purpose = self.rawrows[index.row()] curuser = qtlib.getCurrentUsername(self, self.repo, {}) if user or purpose: if user != curuser: self.showMessage.emit(_('You can only release your own locks')) else: self.unlock(wfile) else: self.lock(wfile, curuser)
def validatePage(self): if self.cmd.core.running(): return False if len(self.repo.parents()) == 1: # commit succeeded, repositoryChanged() called wizard().next() if self.skiplast.isChecked(): self.wizard().close() return True user = qtlib.getCurrentUsername(self, self.repo, self.opts) if not user: return False self.setTitle(_('Committing...')) self.setSubTitle(_('Please wait while committing merged files.')) message = hglib.fromunicode(self.msgEntry.text()) cmdline = [ 'commit', '--verbose', '--message', message, '--repository', self.repo.root, '--user', user ] if self.opts.get('recurseinsubrepos'): cmdline.append('--subrepos') try: date = self.opts.get('date') if date: util.parsedate(date) dcmd = ['--date', date] else: dcmd = [] except error.Abort, e: if e.hint: err = _('%s (hint: %s)') % (hglib.tounicode( str(e)), hglib.tounicode(e.hint)) else: err = hglib.tounicode(str(e)) qtlib.WarningMsgBox( _('TortoiseHg Merge Commit'), _('Error creating interpreting commit date (%s).\n' 'Using current date instead.'), err) dcmd = []
def validatePage(self): if self.cmd.core.running(): return False if len(self.repo.parents()) == 1: # commit succeeded, repositoryChanged() called wizard().next() if self.skiplast.isChecked(): self.wizard().close() return True user = qtlib.getCurrentUsername(self, self.repo, self.opts) if not user: return False self.setTitle(_('Committing...')) self.setSubTitle(_('Please wait while committing merged files.')) message = hglib.fromunicode(self.msgEntry.text()) cmdline = ['commit', '--verbose', '--message', message, '--repository', self.repo.root, '--user', user] if self.opts.get('recurseinsubrepos'): cmdline.append('--subrepos') try: date = self.opts.get('date') if date: util.parsedate(date) dcmd = ['--date', date] else: dcmd = [] except error.Abort, e: if e.hint: err = _('%s (hint: %s)') % (hglib.tounicode(str(e)), hglib.tounicode(e.hint)) else: err = hglib.tounicode(str(e)) qtlib.WarningMsgBox(_('TortoiseHg Merge Commit'), _('Error creating interpreting commit date (%s).\n' 'Using current date instead.'), err) dcmd = []
def onSign(self): if self.cmd.core.running(): self.set_status(_('Repository command still running'), False) return keyu = self.keyLineEdit.text() key = hglib.fromunicode(keyu) local = self.localCheckBox.isChecked() force = self.replaceCheckBox.isChecked() nocommit = self.nocommitCheckBox.isChecked() if self.customCheckBox.isChecked(): msgu = self.customTextLineEdit.text() msg = hglib.fromunicode(msgu) else: msg = None user = qtlib.getCurrentUsername(self, self.repo) if not user: return cmd = ['sign', '--repository', self.repo.root, '--user', user] if key: cmd.append('--key=%s' % key) if force: cmd.append('--force') if local: cmd.append('--local') if nocommit: cmd.append('--no-commit') else: if msg: cmd.append('--message=%s' % msg) cmd.append(str(self.rev)) self.cmd.run(cmd)
def validatePage(self): if self.commitComplete: # commit succeeded, repositoryChanged() called wizard().next() if self.field('skiplast').toBool(): self.wizard().close() return True if not self._cmdsession.isFinished(): return False user = hglib.tounicode(qtlib.getCurrentUsername(self, self.repo)) if not user: return False if self._parentbackout: self.setTitle(_('Backing out and committing...')) self.setSubTitle(_('Please wait while making backout.')) message = unicode(self.msgEntry.text()) cmdline = hglib.buildcmdargs('backout', self._backoutrev, verbose=True, message=message, user=user) else: self.setTitle(_('Committing...')) self.setSubTitle(_('Please wait while committing merged files.')) message = unicode(self.msgEntry.text()) cmdline = hglib.buildcmdargs('commit', verbose=True, message=message, user=user) commandlines = [cmdline] pushafter = self.repo.ui.config('tortoisehg', 'cipushafter') if pushafter: cmd = ['push', hglib.tounicode(pushafter)] commandlines.append(cmd) self._cmdlog.show() sess = self._repoagent.runCommandSequence(commandlines, self) self._cmdsession = sess sess.commandFinished.connect(self.onCommandFinished) sess.outputReceived.connect(self._cmdlog.appendLog) return False
def onSign(self): if not self._cmdsession.isFinished(): self.set_status(_('Repository command still running'), False) return opts = { 'key': self.keyLineEdit.text() or None, 'local': self.localCheckBox.isChecked(), 'force': self.replaceCheckBox.isChecked(), 'no_commit': self.nocommitCheckBox.isChecked(), } if self.customCheckBox.isChecked() and not opts['no_commit']: opts['message'] = self.customTextLineEdit.text() or None user = qtlib.getCurrentUsername(self, self.repo) if not user: return opts['user'] = hglib.tounicode(user) cmdline = hglib.buildcmdargs('sign', self.rev, **opts) sess = self._repoagent.runCommand(cmdline, self) self._cmdsession = sess sess.commandFinished.connect(self.commandFinished)
def onAddTag(self): tagu = self.tagCombo.currentText() tag = hglib.fromunicode(tagu) local = self.localCheckBox.isChecked() force = self.replaceCheckBox.isChecked() english = self.englishCheckBox.isChecked() if self.customCheckBox.isChecked() and not local: message = self.customTextLineEdit.text() else: message = None exists = tag in self.repo.tags() if not local: if not message: ctx = self.repo[self.rev] if exists: origctx = self.repo[self.repo.tags()[tag]] msgset = keep._('Moved tag %s to changeset %s' ' (from changeset %s)') message = ((english and msgset['id'] or msgset['str']) % (tagu, str(ctx), str(origctx))) else: msgset = keep._('Added tag %s for changeset %s') message = ((english and msgset['id'] or msgset['str']) % (tagu, str(ctx))) if exists: finishmsg = _("Tag '%s' has been moved") % tagu else: finishmsg = _("Tag '%s' has been added") % tagu user = qtlib.getCurrentUsername(self, self.repo) if not user: return self._runTag(tagu, rev=self.rev, user=hglib.tounicode(user), local=local, force=force, message=message, finishmsg=finishmsg)
def onAddTag(self): if self.cmd.core.running(): self.set_status(_('Repository command still running'), False) return tagu = self.tagCombo.currentText() tag = hglib.fromunicode(tagu) local = self.localCheckBox.isChecked() force = self.replaceCheckBox.isChecked() english = self.englishCheckBox.isChecked() if self.customCheckBox.isChecked(): message = self.customTextLineEdit.text() else: message = None exists = tag in self.repo.tags() if exists and not force: self.set_status(_("Tag '%s' already exists") % tagu, False) return if not local: parents = self.repo.parents() if len(parents) > 1: self.set_status(_('uncommitted merge'), False) return p1 = parents[0] if not force and p1.node() not in self.repo._branchheads: self.set_status(_('not at a branch head (use force)'), False) return if not message: ctx = self.repo[self.rev] if exists: origctx = self.repo[self.repo.tags()[tag]] msgset = keep._('Moved tag %s to changeset %s' \ ' (from changeset %s)') message = (english and msgset['id'] or msgset['str']) \ % (tagu, str(ctx), str(origctx)) else: msgset = keep._('Added tag %s for changeset %s') message = (english and msgset['id'] or msgset['str']) \ % (tagu, str(ctx)) message = hglib.fromunicode(message) def finished(): if exists: self.set_status(_("Tag '%s' has been moved") % tagu, True) else: self.set_status(_("Tag '%s' has been added") % tagu, True) user = qtlib.getCurrentUsername(self, self.repo) if not user: return cmd = [ 'tag', '--repository', self.repo.root, '--rev', str(self.rev), '--user', user ] if local: cmd.append('--local') else: cmd.append('--message=%s' % message) if force: cmd.append('--force') cmd.append(tag) self.finishfunc = finished self.cmd.run(cmd)