[Pkg-bazaar-commits] ./bzr-gtk/unstable r112: Merge from trunk.

Szilveszter Farkas (Phanatic) Szilveszter.Farkas at gmail.com
Fri Apr 10 07:49:15 UTC 2009


------------------------------------------------------------
revno: 112
committer: Szilveszter Farkas (Phanatic) <Szilveszter.Farkas at gmail.com>
branch nick: bzr-gtk
timestamp: Fri 2006-12-01 19:02:11 +0100
message:
  Merge from trunk.
modified:
  __init__.py
  annotate/gannotate.py
  olive/commit.py
  olive/dialog.py
    ------------------------------------------------------------
    revno: 66.2.1
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: bzr-gtk
    timestamp: Wed 2006-06-21 12:07:11 -0400
    message:
      Gannotate takes a revision argument
    modified:
      __init__.py
      annotate/gannotate.py
    ------------------------------------------------------------
    revno: 66.2.2
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: bzr-gtk
    timestamp: Mon 2006-09-18 09:49:47 -0400
    message:
      Merge from upstream
    added:
      nautilus-bzr.py
    modified:
      .bzrignore
      AUTHORS
      README
      __init__.py
      annotate/gannotate.py
      commit.py
      setup.py
      viz/__init__.py
      viz/branchwin.py
      viz/bzrkapp.py
      viz/diffwin.py
      viz/graph.py
      viz/graphcell.py
    ------------------------------------------------------------
    revno: 66.2.3
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: bzr-gtk
    timestamp: Tue 2006-11-21 09:19:41 -0500
    message:
      Merge from upstream
    removed:
      .bzrignore
      clone.py
      commit.py
      setup.py
    added:
      .bzrignore
      NEWS
      TODO
      cmenu.ui
      genpot.sh
      icons/
      icons/commit.png
      icons/commit16.png
      icons/diff.png
      icons/diff16.png
      icons/log.png
      icons/log16.png
      icons/olive-gtk.png
      icons/pull.png
      icons/pull16.png
      icons/push.png
      icons/push16.png
      icons/refresh.png
      olive/
      olive-gtk
      olive-gtk.desktop
      olive.glade
      olive/__init__.py
      olive/add.py
      olive/bookmark.py
      olive/branch.py
      olive/checkout.py
      olive/commit.py
      olive/dialog.py
      olive/guifiles.py
      olive/info.py
      olive/info_helper.py
      olive/launch.py
      olive/menu.py
      olive/merge.py
      olive/mkdir.py
      olive/move.py
      olive/push.py
      olive/remove.py
      olive/rename.py
      olive/status.py
      olive/ui.py
      oliveicon2.png
      po/
      po/hu.po
      po/olive-gtk.pot
      setup.py
    modified:
      AUTHORS
      COPYING
      README
      __init__.py
      nautilus-bzr.py
    ------------------------------------------------------------
    revno: 66.2.4
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: bzr-gtk
    timestamp: Tue 2006-11-21 09:54:29 -0500
    message:
      Use dotted revnos instead of 'merge' where possible
    modified:
      annotate/gannotate.py
    ------------------------------------------------------------
    revno: 66.2.5
    committer: Aaron Bentley <abentley at panoramicfeedback.com>
    branch nick: bzr-gtk
    timestamp: Tue 2006-11-21 10:30:44 -0500
    message:
      force long revnos to 'merge'
    modified:
      annotate/gannotate.py
    ------------------------------------------------------------
    revno: 66.2.6
    committer: Jelmer Vernooij <jelmer at samba.org>
    branch nick: trunk
    timestamp: Thu 2006-11-30 14:38:23 +0100
    message:
      Merge vila's empty commit message fixes.
    modified:
      olive/commit.py
      olive/dialog.py
        ------------------------------------------------------------
        revno: 66.3.1
        committer: v.ladeuil+lp at free.fr
        branch nick: gtk.non-empty-commit
        timestamp: Thu 2006-11-30 14:25:35 +0100
        message:
          Fix #73737. Check empty message at commit time.
          
          * dialog.py:
          (about): Destroy the dialog unconditionally.
          (_message_dialog): Add a 'question' type dialog. Destroy the
          dialog unconditionally. Always returns the response, even if
          nobody cares.
          (question_dialog): New dialog.
          
          * commit.py:
          (CommitDialog.display): Give the focus to the commit message text
          widget.
          (CommitDialog.commit): Requires confirmation to commit with an
          empty message.
        modified:
          olive/commit.py
          olive/dialog.py
-------------- next part --------------
=== modified file '__init__.py'
--- a/__init__.py	2006-11-04 16:05:23 +0000
+++ b/__init__.py	2006-11-21 14:19:41 +0000
@@ -143,11 +143,12 @@
         Option("all", help="show annotations on all lines"),
         Option("plain", help="don't highlight annotation lines"),
         Option("line", type=int, argname="lineno",
-               help="jump to specified line number")
+               help="jump to specified line number"),
+        "revision",
     ]
     aliases = ["gblame", "gpraise"]
     
-    def run(self, filename, all=False, plain=False, line='1'):
+    def run(self, filename, all=False, plain=False, line='1', revision=None):
         import pygtk
         pygtk.require("2.0")
 
@@ -173,6 +174,12 @@
 
         if file_id is None:
             raise NotVersionedError(filename)
+        if revision is not None:
+            if len(revision) != 1:
+                raise BzrCommandError("Only 1 revion may be specified.")
+            revision_id = revision[0].in_history(branch).rev_id
+        else:
+            revision_id = None
 
         window = GAnnotateWindow(all, plain)
         window.connect("destroy", lambda w: gtk.main_quit())
@@ -181,7 +188,7 @@
         window.show()
         branch.lock_read()
         try:
-            window.annotate(branch, file_id)
+            window.annotate(branch, file_id, revision_id)
         finally:
             branch.unlock()
         window.jump_to_line(line)

=== modified file 'annotate/gannotate.py'
--- a/annotate/gannotate.py	2006-09-05 02:17:19 +0000
+++ b/annotate/gannotate.py	2006-11-21 15:30:44 +0000
@@ -22,6 +22,7 @@
 import gtk
 import pango
 
+from bzrlib import tsort
 from bzrlib.errors import NoSuchRevision
 from bzrlib.revision import NULL_REVISION
 
@@ -57,11 +58,12 @@
         if self.plain:
             self.span_selector.hide()
 
-    def annotate(self, branch, file_id):
+    def annotate(self, branch, file_id, revision_id=None):
         self.revisions = {}
         self.annotations = []
         self.branch = branch
         self.file_id = file_id
+        self.revision_id = revision_id
         
         # [revision id, line number, committer, revno, highlight color, line]
         self.annomodel = gtk.ListStore(gobject.TYPE_STRING,
@@ -76,7 +78,7 @@
             branch.lock_read()
             branch.repository.lock_read()
             for line_no, (revision, revno, line)\
-                    in enumerate(self._annotate(branch, file_id)):
+                    in enumerate(self._annotate(branch, file_id, revision_id)):
                 if revision.revision_id == last_seen and not self.all:
                     revno = committer = ""
                 else:
@@ -121,23 +123,37 @@
         self.annoview.set_cursor(row)
         self.annoview.scroll_to_cell(row, use_align=True)
 
-    def _annotate(self, branch, file_id):
-        rev_hist = branch.revision_history()
+    def _dotted_revnos(self, repository, revision_id):
+        """Return a dict of revision_id -> dotted revno
+        
+        :param repository: The repository to get the graph from
+        :param revision_id: The last revision for which this info is needed
+        """
+        graph = repository.get_revision_graph(revision_id)
+        dotted = {}
+        for n, revision_id, d, revno, e in tsort.merge_sort(graph, 
+            revision_id, generate_revno=True):
+            dotted[revision_id] = '.'.join(str(num) for num in revno)
+        return dotted
+
+    def _annotate(self, branch, file_id, revision_id):
         repository = branch.repository
-        rev_tree = repository.revision_tree(branch.last_revision())
-        rev_id = rev_tree.inventory[file_id].revision
+        if revision_id is None:
+            revision_id = branch.last_revision()
+        dotted = self._dotted_revnos(repository, revision_id)
+        rev_tree = repository.revision_tree(revision_id)
+        revision_id = rev_tree.inventory[file_id].revision
         weave = repository.weave_store.get_weave(file_id,
                                                  branch.get_transaction())
         
         revision_cache = RevisionCache(repository)
-        for origin, text in weave.annotate_iter(rev_id):
+        for origin, text in weave.annotate_iter(revision_id):
             rev_id = origin
             try:
                 revision = revision_cache.get_revision(rev_id)
-                if rev_id in rev_hist:
-                    revno = branch.revision_id_to_revno(rev_id)
-                else:
-                    revno = "merge"
+                revno = dotted.get(rev_id, 'merge')
+                if len(revno) > 15:
+                    revno = 'merge'
             except NoSuchRevision:
                 revision = NoneRevision(rev_id)
                 revno = "?"

=== modified file 'olive/commit.py'
--- a/olive/commit.py	2006-11-02 23:01:58 +0000
+++ b/olive/commit.py	2006-11-30 13:25:35 +0000
@@ -28,7 +28,7 @@
 import bzrlib.errors as errors
 from bzrlib import osutils
 
-from dialog import error_dialog
+from dialog import error_dialog, question_dialog
 from guifiles import GLADEFILENAME
 
 
@@ -85,12 +85,12 @@
             error_dialog(_('Directory does not have a working tree'),
                          _('Operation aborted.'))
             self.close()
-            return False
+            dialog_shown = False
         if self.notbranch:
             error_dialog(_('Directory is not a branch'),
                          _('You can perform this action only in a branch.'))
             self.close()
-            return False
+            dialog_shown = False
         else:
             if self.wt.branch.get_bound_location() is not None:
                 # we have a checkout, so the local commit checkbox must appear
@@ -105,7 +105,11 @@
             
             self.textview.modify_font(pango.FontDescription("Monospace"))
             self.window.show()
-            return True
+            dialog_shown = True
+        if dialog_shown:
+            # Gives the focus to the commit message area
+            self.textview.grab_focus()
+        return dialog_shown
     
     def _create_file_view(self):
         self.file_store = gtk.ListStore(gobject.TYPE_BOOLEAN,   # [0] checkbox
@@ -259,9 +263,18 @@
             specific_files = self._get_specific_files()
         else:
             specific_files = None
-        
+
+        if message == '':
+            response = question_dialog('Commit with an empty message ?',
+                                       'You can describe your commit intent'
+                                       +' in the message')
+            if response == gtk.RESPONSE_NO:
+                # Kindly give focus to message area
+                self.textview.grab_focus()
+                return
+
         try:
-            self.wt.commit(message, 
+            self.wt.commit(message,
                            allow_pointless=checkbutton_force.get_active(),
                            strict=checkbutton_strict.get_active(),
                            local=self.checkbutton_local.get_active(),

=== modified file 'olive/dialog.py'
--- a/olive/dialog.py	2006-10-25 16:29:18 +0000
+++ b/olive/dialog.py	2006-11-30 13:25:35 +0000
@@ -35,10 +35,10 @@
 
     # Set version
     dialog.set_version(olive.__version__)
-    
+
+    dialog.run()
     # Destroy the dialog
-    if dialog.run() == gtk.RESPONSE_CANCEL:
-        dialog.destroy()
+    dialog.destroy()
 
 def _message_dialog(type, primary, secondary):
     """ Display a given type of MessageDialog with the given message.
@@ -62,22 +62,33 @@
                                    type=gtk.MESSAGE_INFO,
                                    buttons=gtk.BUTTONS_OK)
         dialog.set_markup('<big><b>' + primary + '</b></big>')
+    elif type == 'question':
+        dialog = gtk.MessageDialog(flags=gtk.DIALOG_MODAL,
+                                   type=gtk.MESSAGE_QUESTION,
+                                   buttons=gtk.BUTTONS_YES_NO)
+        dialog.set_markup('<big><b>' + primary + '</b></big>')
     else:
         return
-    
+
     dialog.format_secondary_markup(secondary)
-    
-    if dialog.run() == gtk.RESPONSE_OK:
-        dialog.destroy()
+
+    response = dialog.run()
+    dialog.destroy()
+
+    return response
 
 def error_dialog(primary, secondary):
     """ Display an error dialog with the given message. """
-    _message_dialog('error', primary, secondary)
+    return _message_dialog('error', primary, secondary)
 
 def info_dialog(primary, secondary):
     """ Display an info dialog with the given message. """
-    _message_dialog('info', primary, secondary)
+    return _message_dialog('info', primary, secondary)
 
 def warning_dialog(primary, secondary):
     """ Display a warning dialog with the given message. """
-    _message_dialog('warning', primary, secondary)
+    return _message_dialog('warning', primary, secondary)
+
+def question_dialog(primary, secondary):
+    """ Display a dialog with the given question. """
+    return _message_dialog('question', primary, secondary)



More information about the Pkg-bazaar-commits mailing list