sfa now under git, needs sfa-GITPATH
[build.git] / module-tools.py
index 4a4a879..f14da95 100755 (executable)
@@ -302,12 +302,13 @@ class GitRepository:
         if branch == "master":
             self.__run_command_in_repo("git checkout %s" % branch)
         else:
-            self.__run_command_in_repo("git checkout origin/%s" % branch)
+            self.to_branch(branch, remote=True)
         self.__run_command_in_repo("git fetch origin --tags")
         self.__run_command_in_repo("git fetch origin")
         self.__run_command_in_repo("git merge --ff origin/%s" % branch)
 
     def to_branch(self, branch, remote=True):
+        self.revert()
         if remote:
             command = "git branch --track %s origin/%s" % (branch, branch)
             c = Command(command, self.options)
@@ -315,6 +316,7 @@ class GitRepository:
         return self.__run_command_in_repo("git checkout %s" % branch)
 
     def to_tag(self, tag):
+        self.revert()
         return self.__run_command_in_repo("git checkout %s" % tag)
 
     def tag(self, tagname, logfile):
@@ -336,7 +338,7 @@ class GitRepository:
         if branch == "master":
             self.__run_command_in_repo("git push")
         else:
-            self.__run_command_in_repo("git push %s:%s" % (branch, branch))
+            self.__run_command_in_repo("git push origin %s:%s" % (branch, branch))
         self.__run_command_in_repo("git push --tags")
 
     def revert(self, f=""):