Commits

Yuki KODAMA  committed 4395e2e

tagadd: preselect existing tag to remove it quickly

  • Participants
  • Parent commits 86ac5ec
  • Branches stable

Comments (0)

Files changed (2)

File tortoisehg/hgtk/history.py

         # save tag info for detecting new tags added
         oldtags = self.repo.tagslist()
         oldlen = len(self.repo)
-        rev = self.currevid
+        rev = str(self.currevid)
+        for t in self.repo.nodetags(self.repo[rev].node()):
+            if t != 'tip':
+                tag = t
+                break;
+        else:
+            tag = ''
 
         def refresh(*args):
             self.repo.invalidate()
                 if newtags != oldtags:
                     self.refresh_model()
 
-        dialog = tagadd.TagAddDialog(self.repo, rev=str(rev))
+        dialog = tagadd.TagAddDialog(self.repo, tag, rev)
         dialog.connect('destroy', refresh)
         self.show_dialog(dialog)
 

File tortoisehg/hgtk/tagadd.py

 
         # prepare to show
         self.load_settings()
-        self._refresh()
+        self._refresh(clear=False)
         self._taglistbox.grab_focus()
 
-    def _refresh(self):
+    def _refresh(self, clear=True):
         """ update display on dialog with recent repo data """
         self.repo.invalidate()
         self._tagslist.clear()
-        self._tag_input.set_text("")
 
         # add tags to drop-down list
         tags = [x[0] for x in self.repo.tagslist()]
         tags.sort()
         for tagname in tags:
-            if tagname == "tip":
+            if tagname == 'tip':
                 continue
             self._tagslist.append([tagname])
 
+        # clear tag input
+        if clear:
+            self._tag_input.set_text('')
+
     def load_settings(self):
         expanded = self.settings.get_value('expanded', False, True)
         self.expander.set_property('expanded', expanded)