Commits

Yuya Nishihara committed 4464804

bookmark: add command-line entry point

Comments (0)

Files changed (2)

tortoisehg/hgqt/bookmark.py

     output = pyqtSignal(QString, QString)
     makeLogVisible = pyqtSignal(bool)
 
-    def __init__(self, repo, rev, parent):
+    def __init__(self, repo, rev, parent=None):
         super(BookmarkDialog, self).__init__(parent)
         self.setWindowFlags(self.windowFlags() & \
                             ~Qt.WindowContextHelpButtonHint)
             self.renameBtn.setEnabled(False)
             self.newNameEdit.setEnabled(False)
 
+    def setBookmarkName(self, name):
+        self.bookmarkCombo.setEditText(name)
+
     def set_status(self, text, icon=None):
         self.status.setShown(True)
         self.sep.setShown(True)

tortoisehg/hgqt/run.py

     from tortoisehg.hgqt import bisect as bisectmod
     return bisectmod.BisectDialog(repo, opts)
 
+@command('bookmarks|bookmark',
+    [('r', 'rev', '', _('revision'))],
+    _('thg bookmarks [-r REV] [NAME]'))
+def bookmark(ui, repo, *names, **opts):
+    """add or remove a movable marker"""
+    from tortoisehg.hgqt import bookmark as bookmarkmod
+    rev = scmutil.revsingle(repo, opts.get('rev')).rev()
+    if len(names) > 1:
+        raise util.Abort(_('only one new bookmark name allowed'))
+    dlg = bookmarkmod.BookmarkDialog(repo, rev)
+    if names:
+        dlg.setBookmarkName(hglib.tounicode(names[0]))
+    return dlg
+
 @command('^clone',
     [('U', 'noupdate', None, _('the clone will include an empty working copy '
                                '(only a repository)')),