git://git.onelab.eu
/
build.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
fc38950
)
keep track of remote branches locally to be able to push w/o errors
author
Barış Metin
<Talip-Baris.Metin@sophia.inria.fr>
Tue, 27 Jul 2010 09:55:13 +0000
(11:55 +0200)
committer
Barış Metin
<Talip-Baris.Metin@sophia.inria.fr>
Tue, 27 Jul 2010 09:55:13 +0000
(11:55 +0200)
module-tools.py
patch
|
blob
|
history
diff --git
a/module-tools.py
b/module-tools.py
index
940e4b5
..
4a4a879
100755
(executable)
--- a/
module-tools.py
+++ b/
module-tools.py
@@
-309,7
+309,9
@@
class GitRepository:
def to_branch(self, branch, remote=True):
if remote:
def to_branch(self, branch, remote=True):
if remote:
- branch = "origin/%s" % branch
+ command = "git branch --track %s origin/%s" % (branch, branch)
+ c = Command(command, self.options)
+ self.__run_in_repo(c.output_of, with_stderr=True)
return self.__run_command_in_repo("git checkout %s" % branch)
def to_tag(self, tag):
return self.__run_command_in_repo("git checkout %s" % branch)
def to_tag(self, tag):
@@
-327,11
+329,14
@@
class GitRepository:
c = Command("git diff %s" % tagname, self.options)
return self.__run_in_repo(c.output_of, with_stderr=True)
c = Command("git diff %s" % tagname, self.options)
return self.__run_in_repo(c.output_of, with_stderr=True)
- def commit(self, logfile):
+ def commit(self, logfile
, branch="master"
):
self.__run_command_in_repo("git add .", ignore_errors=True)
self.__run_command_in_repo("git add -u", ignore_errors=True)
self.__run_command_in_repo("git commit -F %s" % logfile, ignore_errors=True)
self.__run_command_in_repo("git add .", ignore_errors=True)
self.__run_command_in_repo("git add -u", ignore_errors=True)
self.__run_command_in_repo("git commit -F %s" % logfile, ignore_errors=True)
- self.__run_command_in_repo("git push")
+ 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 --tags")
def revert(self, f=""):
self.__run_command_in_repo("git push --tags")
def revert(self, f=""):
@@
-997,7
+1002,10
@@
n: move to next file"""%locals()
print self.repository.diff()
def commit_all_changes(log):
print self.repository.diff()
def commit_all_changes(log):
- self.repository.commit(log)
+ if hasattr(self,'branch'):
+ self.repository.commit(log, branch=self.branch)
+ else:
+ self.repository.commit(log)
build.commit(log)
self.run_prompt("Review module and build", diff_all_changes)
build.commit(log)
self.run_prompt("Review module and build", diff_all_changes)