Did post-commit merging
authorAaron Bentley <abentley@panoramicfeedback.com>
Fri, 3 Feb 2006 20:44:25 +0000 (15:44 -0500)
committerAaron Bentley <abentley@panoramicfeedback.com>
Fri, 3 Feb 2006 20:44:25 +0000 (15:44 -0500)
libbe/bzr.py

index b8d1c8c8b1f5444eed5066fe4d856830457a57f4..c6fc6223e9cfa086b70a0fb71373f54aab3495e4 100644 (file)
@@ -21,7 +21,7 @@ import config
 from rcs import invoke, CommandError
 
 def invoke_client(*args, **kwargs):
-    directory = kwargs.get('directory')
+    directory = kwargs['directory']
     expect = kwargs.get('expect', (0, 1))
     cl_args = ["bzr"]
     cl_args.extend(args)
@@ -111,12 +111,19 @@ def commit(directory, summary, body=None):
         temp_file = os.fdopen(descriptor, 'wb')
         temp_file.write(summary)
         temp_file.close()
-        try:
-            invoke_client('commit', '--unchanged', '--file', filename, 
-                          directory=directory)
+        invoke_client('commit', '--unchanged', '--file', filename, 
+                      directory=directory)
     finally:
         os.unlink(filename)
 
 def postcommit(directory):
-    pass
+    try:
+        status = invoke_client('merge', directory=directory)
+    except CommandError:
+        status = invoke_client('revert --no-backup', directory=directory)
+        status = invoke_client('resolve --all', directory=directory)
+        raise
+    if status == 1:
+        commit(directory, 'Merge from upstream')
+    
 name = "bzr"