[Pkg-bazaar-commits] ./bzr-gtk/unstable r275: Merge some changes from Mateusz.

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


------------------------------------------------------------
revno: 275
committer: Szilveszter Farkas (Phanatic) <Szilveszter.Farkas at gmail.com>
branch nick: trunk
timestamp: Fri 2007-09-14 11:03:13 +0200
message:
  Merge some changes from Mateusz.
modified:
  merge.py
  olive/__init__.py
    ------------------------------------------------------------
    revno: 274.1.1
    committer: Mateusz Korniak <matkor at laptop-hp>
    branch nick: trunk-matkor
    timestamp: Tue 2007-09-11 11:49:40 +0200
    message:
      Use find_unmerged() instead of branch.missing_revisions().
      Fixes bug both branches have extra revisions.
      Short info about first 10 missing/extra revisions.
    modified:
      olive/__init__.py
    ------------------------------------------------------------
    revno: 274.1.2
    committer: Mateusz Korniak <matkor at laptop-hp>
    branch nick: trunk-matkor
    timestamp: Tue 2007-09-11 12:17:33 +0200
    message:
      Add default_branch_path to MergeDialog and use it from olive-gtk
    modified:
      merge.py
      olive/__init__.py
    ------------------------------------------------------------
    revno: 274.1.3
    committer: Mateusz Korniak <matkor at laptop-hp>
    branch nick: trunk-matkor
    timestamp: Tue 2007-09-11 12:53:51 +0200
    message:
      Bugfix - local missing revisions are remote extra revisions.
    modified:
      olive/__init__.py
    ------------------------------------------------------------
    revno: 274.1.4
    committer: Mateusz Korniak <matkor at laptop-hp>
    branch nick: trunk-matkor
    timestamp: Fri 2007-09-14 10:40:45 +0200
    message:
      Commented out one line description of log_revison in dialogs. 
      Dialog looks ugly with them.
    modified:
      olive/__init__.py
-------------- next part --------------
=== modified file 'merge.py'
--- a/merge.py	2007-02-03 14:19:44 +0000
+++ b/merge.py	2007-09-11 10:17:33 +0000
@@ -35,7 +35,7 @@
 
 class MergeDialog:
     """ Display the Merge dialog and perform the needed actions. """
-    def __init__(self, wt, wtpath):
+    def __init__(self, wt, wtpath,default_branch_path=None):
         """ Initialize the Merge dialog. """
         self.glade = gtk.glade.XML(GLADEFILENAME, 'window_merge', 'olive-gtk')
         
@@ -54,6 +54,8 @@
         
         # Get some widgets
         self.entry = self.glade.get_widget('entry_merge')
+        if default_branch_path:
+            self.entry.set_text(default_branch_path)
 
     def display(self):
         """ Display the Add file(s) dialog. """

=== modified file 'olive/__init__.py'
--- a/olive/__init__.py	2007-08-25 13:03:46 +0000
+++ b/olive/__init__.py	2007-09-14 08:40:45 +0000
@@ -527,30 +527,65 @@
             error_dialog(_('There are local changes in the branch'),
                          _('Please commit or revert the changes before merging.'))
         else:
-            merge = MergeDialog(self.wt, self.wtpath)
+            parent_branch_path = self.wt.branch.get_parent()
+            merge = MergeDialog(self.wt, self.wtpath,default_branch_path=parent_branch_path )
             merge.display()
 
     @show_bzr_error
     def on_menuitem_branch_missing_revisions_activate(self, widget):
         """ Branch/Missing revisions menu handler. """
+        
+        from bzrlib.missing import find_unmerged, iter_log_revisions
+        
         local_branch = self.wt.branch
-        
-        other_branch = local_branch.get_parent()
-        if other_branch is None:
+        parent_branch_path = local_branch.get_parent()
+        if parent_branch_path is None:
             error_dialog(_('Parent location is unknown'),
                          _('Cannot determine missing revisions if no parent location is known.'))
             return
         
-        remote_branch = Branch.open(other_branch)
-        
-        if remote_branch.base == local_branch.base:
-            remote_branch = local_branch
-
-        ret = len(local_branch.missing_revisions(remote_branch))
-
-        if ret > 0:
+        parent_branch = Branch.open(parent_branch_path)
+        
+        if parent_branch.base == local_branch.base:
+            parent_branch = local_branch
+        
+        local_extra, remote_extra = find_unmerged(local_branch,parent_branch)
+
+        if local_extra or remote_extra:
+            
+            ## def log_revision_one_line_text(log_revision):
+            ##    """ Generates one line description of log_revison ended with end of line."""
+            ##    revision = log_revision.rev
+            ##    txt =  "- %s (%s)\n" % (revision.get_summary(), revision.committer, )
+            ##    txt = txt.replace("<"," ") # Seems < > chars are expected to be xml tags ...
+            ##    txt = txt.replace(">"," ")
+            ##    return txt
+            
+            dlg_txt = ""
+            if local_extra:
+                dlg_txt += _('%d local extra revision(s). \n') % (len(local_extra),) 
+                ## NOTE: We do not want such ugly info about missing revisions
+                ##       Revision Browser should be used there
+                ## max_revisions = 10
+                ## for log_revision in iter_log_revisions(local_extra, local_branch.repository, verbose=1):
+                ##    dlg_txt += log_revision_one_line_text(log_revision)
+                ##    if max_revisions <= 0:
+                ##        dlg_txt += _("more ... \n")
+                ##        break
+                ## max_revisions -= 1
+            ## dlg_txt += "\n"
+            if remote_extra:
+                dlg_txt += _('%d local missing revision(s).\n') % (len(remote_extra),) 
+                ## max_revisions = 10
+                ## for log_revision in iter_log_revisions(remote_extra, parent_branch.repository, verbose=1):
+                ##    dlg_txt += log_revision_one_line_text(log_revision)
+                ##    if max_revisions <= 0:
+                ##        dlg_txt += _("more ... \n")
+                ##        break
+                ##    max_revisions -= 1
+                
             info_dialog(_('There are missing revisions'),
-                        _('%d revision(s) missing.') % ret)
+                        dlg_txt)
         else:
             info_dialog(_('Local branch up to date'),
                         _('There are no missing revisions.'))



More information about the Pkg-bazaar-commits mailing list