[Pkg-bazaar-commits] ./bzr-gtk/unstable r122: Do not allow merge if there are local changes (Fixed: #73770).

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


------------------------------------------------------------
revno: 122
committer: Szilveszter Farkas (Phanatic) <Szilveszter.Farkas at gmail.com>
branch nick: bzr-gtk
timestamp: Mon 2006-12-18 10:35:14 +0100
message:
  Do not allow merge if there are local changes (Fixed: #73770).
modified:
  olive/__init__.py
-------------- next part --------------
=== modified file 'olive/__init__.py'
--- a/olive/__init__.py	2006-12-17 23:22:10 +0000
+++ b/olive/__init__.py	2006-12-18 09:35:14 +0000
@@ -229,8 +229,13 @@
     def on_menuitem_branch_merge_activate(self, widget):
         """ Branch/Merge... menu handler. """
         from merge import MergeDialog
-        merge = MergeDialog(self.wt, self.wtpath)
-        merge.display()
+        
+        if self.check_for_changes():
+            error_dialog(_('There are local changes in the branch'),
+                         _('Please commit or revert the changes before merging.'))
+        else:
+            merge = MergeDialog(self.wt, self.wtpath)
+            merge.display()
 
     def on_menuitem_branch_missing_revisions_activate(self, widget):
         """ Branch/Missing revisions menu handler. """
@@ -837,6 +842,18 @@
             drive = model[active][0]
             self.set_path(drive + '\\')
             self.refresh_right(drive + '\\')
+    
+    def check_for_changes(self):
+        """ Check whether there were changes in the current working tree. """
+        old_tree = self.wt.branch.repository.revision_tree(self.wt.branch.last_revision())
+        delta = self.wt.changes_from(old_tree)
+
+        changes = False
+        
+        if len(delta.added) or len(delta.removed) or len(delta.renamed) or len(delta.modified):
+            changes = True
+        
+        return changes
 
 import ConfigParser
 



More information about the Pkg-bazaar-commits mailing list