Pull command tracks the right branch
authorFrederic Massart <fred@moodle.com>
Thu, 13 Nov 2014 05:45:12 +0000 (13:45 +0800)
committerFrederic Massart <fred@moodle.com>
Thu, 13 Nov 2014 05:45:12 +0000 (13:45 +0800)
mdk/commands/pull.py
mdk/fetch.py

index 2656ce1..fe83469 100644 (file)
@@ -158,7 +158,7 @@ class PullCommand(Command):
                 newBranch = M.generateBranchName(issue, suffix=suffix, version=branch)
                 if not M.git().hasBranch(newBranch):
                     break
-            fetcher.pull(into=newBranch)
+            fetcher.pull(into=newBranch, track=M.get('stablebranch'))
 
     def pickPatches(self, mdl):
         """Prompts the user to pick a patch"""
index d9640e2..d7f7bfc 100644 (file)
@@ -68,7 +68,7 @@ class Fetch(object):
         if not self.M.git().merge('FETCH_HEAD'):
             raise FetchException('Merge failed, resolve the conflicts and commit')
 
-    def pull(self, into=None):
+    def pull(self, into=None, track=None):
         """Fetch and merge the fetched branch into a branch passed as param"""
         self._stash()
 
@@ -81,7 +81,7 @@ class Fetch(object):
 
                 if not git.hasBranch(into):
                     if self.canCreateBranch:
-                        if not git.createBranch(into):
+                        if not git.createBranch(into, track=track):
                             raise FetchException('Could not create the branch %s' % (into))
                     else:
                         raise FetchException('Branch %s does not exist and create branch is forbidden' % (into))