def test_Commit_strip_comments_unicode(self): """Ensure that unicode is preserved in stripped commit messages""" msg = unichr(0x1234) + '\n\n#comment\nbody' expect = unichr(0x1234) + '\n\nbody\n' actual = cmds.Commit.strip_comments(msg) self.assertEqual(expect, actual)
def test_translates_noun(self): """Test that strings with @@noun are translated """ i18n.install("ja_JP") expect = unichr(0x30B3) + unichr(0x30DF) + unichr(0x30C3) + unichr(0x30C8) actual = N_("Commit@@verb") self.assertEqual(expect, actual)
def test_translates_noun(self): """Test that strings with @@noun are translated """ i18n.install('ja_JP') expect = (unichr(0x30b3) + unichr(0x30df) + unichr(0x30c3) + unichr(0x30c8)) actual = N_('Commit@@verb') self.assertEqual(expect, actual)
def _update_callback(self): """Update the title with the current branch and directory name.""" alerts = [] branch = self.model.currentbranch curdir = core.getcwd() is_merging = self.model.is_merging is_rebasing = self.model.is_rebasing msg = N_('Repository: %s') % curdir msg += '\n' msg += N_('Branch: %s') % branch if is_rebasing: msg += '\n\n' msg += N_('This repository is currently being rebased.\n' 'Resolve conflicts, commit changes, and run:\n' ' Rebase > Continue') alerts.append(N_('Rebasing')) elif is_merging: msg += '\n\n' msg += N_('This repository is in the middle of a merge.\n' 'Resolve conflicts and commit changes.') alerts.append(N_('Merging')) if self.mode == self.model.mode_amend: alerts.append(N_('Amending')) l = unichr(0xab) r = unichr(0xbb) title = ('%s: %s %s%s' % ( self.model.project, branch, alerts and ((r+' %s '+l+' ') % ', '.join(alerts)) or '', self.model.git.worktree())) self.setWindowTitle(title) self.commitdockwidget.setToolTip(msg) self.commitmsgeditor.set_mode(self.mode) self.update_actions() if not self.model.amending(): # Check if there's a message file in .git/ merge_msg_path = gitcmds.merge_message_path() if merge_msg_path is None: return merge_msg_hash = utils.checksum(merge_msg_path) if merge_msg_hash == self.merge_message_hash: return self.merge_message_hash = merge_msg_hash cmds.do(cmds.LoadCommitMessageFromFile, merge_msg_path)
def build_recent_menu(self): recent = settings.Settings().recent cmd = cmds.OpenRepo menu = self.open_recent_menu menu.clear() for r in recent: name = os.path.basename(r) directory = os.path.dirname(r) text = '%s %s %s' % (name, unichr(0x2192), directory) menu.addAction(text, cmds.run(cmd, r))
def _update_callback(self): """Update the title with the current branch and directory name.""" alerts = [] branch = self.model.currentbranch curdir = core.getcwd() is_merging = self.model.is_merging is_rebasing = self.model.is_rebasing msg = N_("Repository: %s") % curdir msg += "\n" msg += N_("Branch: %s") % branch if is_rebasing: msg += "\n\n" msg += N_( "This repository is currently being rebased.\n" "Resolve conflicts, commit changes, and run:\n" " Rebase > Continue" ) alerts.append(N_("Rebasing")) elif is_merging: msg += "\n\n" msg += N_("This repository is in the middle of a merge.\n" "Resolve conflicts and commit changes.") alerts.append(N_("Merging")) if self.mode == self.model.mode_amend: alerts.append(N_("Amending")) l = unichr(0xAB) r = unichr(0xBB) title = "%s: %s %s%s" % ( self.model.project, branch, alerts and ((r + " %s " + l + " ") % ", ".join(alerts)) or "", self.model.git.worktree(), ) self.setWindowTitle(title) self.commitdockwidget.setToolTip(msg) self.commitmsgeditor.set_mode(self.mode) self.update_actions()
def _update_callback(self): """Update the title with the current branch and directory name.""" alerts = [] branch = self.model.currentbranch curdir = core.getcwd() is_merging = self.model.is_merging is_rebasing = self.model.is_rebasing msg = N_('Repository: %s') % curdir msg += '\n' msg += N_('Branch: %s') % branch if is_rebasing: msg += '\n\n' msg += N_('This repository is currently being rebased.\n' 'Resolve conflicts, commit changes, and run:\n' ' Rebase > Continue') alerts.append(N_('Rebasing')) elif is_merging: msg += '\n\n' msg += N_('This repository is in the middle of a merge.\n' 'Resolve conflicts and commit changes.') alerts.append(N_('Merging')) if self.mode == self.model.mode_amend: alerts.append(N_('Amending')) l = unichr(0xab) r = unichr(0xbb) title = ('%s: %s %s%s' % ( self.model.project, branch, alerts and ((r+' %s '+l+' ') % ', '.join(alerts)) or '', self.model.git.worktree())) self.setWindowTitle(title) self.commitdockwidget.setToolTip(msg) self.commitmsgeditor.set_mode(self.mode) self.update_actions()