Pull raises an exception when branch cannot be created
authorFrederic Massart <fred@moodle.com>
Mon, 2 Sep 2013 06:33:55 +0000 (14:33 +0800)
committerFrederic Massart <fred@moodle.com>
Mon, 2 Sep 2013 06:33:55 +0000 (14:33 +0800)
lib/commands/pull.py

index 9264731..41b2cff 100644 (file)
@@ -172,7 +172,8 @@ class PullCommand(Command):
                 if not M.git().hasBranch(newBranch):
                     break
             track = '%s/%s' % (self.C.get('upstreamRemote'), M.get('stablebranch'))
-            M.git().createBranch(newBranch, track=track)
+            if not M.git().createBranch(newBranch, track=track):
+                raise Exception('Could not create branch %s tracking %s' % (newBranch, track))
             if not M.git().checkout(newBranch):
                 raise Exception('Could not checkout branch %s' % (newBranch))
             logging.info('Checked out branch %s' % (newBranch))
@@ -193,7 +194,8 @@ class PullCommand(Command):
                 if not M.git().hasBranch(newBranch):
                     break
             track = '%s/%s' % (self.C.get('upstreamRemote'), M.get('stablebranch'))
-            M.git().createBranch(newBranch, track=track)
+            if not M.git().createBranch(newBranch, track=track):
+                raise Exception('Could not create branch %s tracking %s' % (newBranch, track))
             if not M.git().checkout(newBranch):
                 raise Exception('Could not checkout branch %s' % (newBranch))
             logging.info('Checked out branch %s' % (newBranch))