[Pkg-bazaar-commits] ./bzr-gtk/unstable r572: Merge addition of gmerge command line option

Jasper Groenewegen colbrac at xs4all.nl
Fri Apr 10 07:50:44 UTC 2009


------------------------------------------------------------
revno: 572
committer: Jasper Groenewegen <colbrac at xs4all.nl>
branch nick: trunk
timestamp: Fri 2008-07-25 20:45:04 +0200
message:
  Merge addition of gmerge command line option
modified:
  NEWS
  __init__.py
  merge.py
    ------------------------------------------------------------
    revno: 571.1.1
    committer: Jasper Groenewegen <colbrac at xs4all.nl>
    branch nick: add-gmerge
    timestamp: Fri 2008-07-25 17:42:45 +0200
    message:
      Add gmerge command and change MergeDialog to set parent as default if available
    modified:
      __init__.py
      merge.py
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2008-07-25 13:32:06 +0000
+++ b/NEWS	2008-07-25 18:45:04 +0000
@@ -68,6 +68,8 @@
     re-enable signature display. (Jelmer Vernooij)
 
   * Show credits for bzr-gtk in the about dialog. (Jelmer Vernooij)
+  
+  * Add gmerge command line option (Jasper Groenewegen, #124760)
 
  INTERNALS
 

=== modified file '__init__.py'
--- a/__init__.py	2008-07-04 08:05:17 +0000
+++ b/__init__.py	2008-07-25 15:42:45 +0000
@@ -22,6 +22,7 @@
 gconflicts        GTK+ conflicts. 
 gdiff             Show differences in working tree in a GTK+ Window. 
 ginit             Initialise a new branch.
+gmerge            GTK+ merge dialog
 gmissing          GTK+ missing revisions dialog. 
 gpreferences      GTK+ preferences dialog. 
 gpush             GTK+ push.
@@ -451,6 +452,29 @@
         dialog.run()
 
 
+class cmd_gmerge(Command):
+    """ GTK+ merge dialog
+    
+    """
+    takes_args = ["merge_from_path?"]
+    def run(self, merge_from_path=None):
+        from bzrlib import workingtree
+        from bzrlib.plugins.gtk.dialog import error_dialog
+        from bzrlib.plugins.gtk.merge import MergeDialog
+        
+        (wt, path) = workingtree.WorkingTree.open_containing('.')
+        old_tree = wt.branch.repository.revision_tree(wt.branch.last_revision())
+        delta = wt.changes_from(old_tree)
+        if len(delta.added) or len(delta.removed) or len(delta.renamed) or len(delta.modified):
+            error_dialog(_i18n('There are local changes in the branch'),
+                         _i18n('Please commit or revert the changes before merging.'))
+        else:
+            parent_branch_path = wt.branch.get_parent()
+            merge = MergeDialog(wt, path, parent_branch_path)
+            response = merge.run()
+            merge.destroy()
+
+
 class cmd_gmissing(Command):
     """ GTK+ missing revisions dialog.
 
@@ -514,6 +538,7 @@
     cmd_gconflicts, 
     cmd_gdiff,
     cmd_ginit,
+    cmd_gmerge,
     cmd_gmissing, 
     cmd_gpreferences, 
     cmd_gpush, 

=== modified file 'merge.py'
--- a/merge.py	2008-07-18 18:21:26 +0000
+++ b/merge.py	2008-07-25 15:42:45 +0000
@@ -46,7 +46,10 @@
         self.wt = wt
         self.wtpath = wtpath
         
-        directory = os.path.dirname(self.wt.abspath(self.wtpath))
+        if default_branch_path and os.path.isdir(default_branch_path.partition('file://')[2]):
+            directory = default_branch_path.partition('file://')[2]
+        else:
+            directory = os.path.dirname(self.wt.abspath(self.wtpath))
         
         # Create widgets
         self._hbox = gtk.HBox()



More information about the Pkg-bazaar-commits mailing list