projects
/
mass-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:
3a6b5ad
)
Add support to force a reset of the source code version
author
Ralf Jung
<post@ralfj.de>
Fri, 3 Aug 2012 17:36:49 +0000
(19:36 +0200)
committer
Ralf Jung
<post@ralfj.de>
Fri, 3 Aug 2012 17:36:49 +0000
(19:36 +0200)
mass_build.py
patch
|
blob
|
history
vcs.py
patch
|
blob
|
history
diff --git
a/mass_build.py
b/mass_build.py
index 1c84070b3d918ed7de24fdc76c00af8d8dbfe651..cdf511402caad26525c0acc6d46d581b55333b06 100755
(executable)
--- a/
mass_build.py
+++ b/
mass_build.py
@@
-11,6
+11,9
@@
parser.add_argument("-c, --config",
parser.add_argument("--reconfigure",
action="store_true", dest="reconfigure",
help="Force configuration to be run")
parser.add_argument("--reconfigure",
action="store_true", dest="reconfigure",
help="Force configuration to be run")
+parser.add_argument("--reset-source",
+ action="store_true", dest="reset_source",
+ help="Reset sourcecode to the given version (removes local changes!)")
parser.add_argument("--no-update",
action="store_false", dest="update",
help="Do not update modules before compilation")
parser.add_argument("--no-update",
action="store_false", dest="update",
help="Do not update modules before compilation")
@@
-20,6
+23,9
@@
parser.add_argument("--resume-from", metavar='MODULE',
parser.add_argument("modules", metavar='MODULE', nargs='*',
help="Manually specify modules to be built")
args = parser.parse_args()
parser.add_argument("modules", metavar='MODULE', nargs='*',
help="Manually specify modules to be built")
args = parser.parse_args()
+# sanitize
+if args.reset_source and not args.update:
+ raise Exception("When no update is performed, no reset to the given version can be done either")
# load config
config = imp.load_source('config', args.config).__dict__
# load config
config = imp.load_source('config', args.config).__dict__
@@
-96,7
+102,7
@@
for project in workProjects:
try:
if args.update:
print "Updating module",project.sourceFolder()
try:
if args.update:
print "Updating module",project.sourceFolder()
- project.vcs.update()
+ project.vcs.update(
forceVersion=args.reset_source
)
print "Building module",project.sourceFolder()
project.buildSystem.build(reconfigure=args.reconfigure)
print
print "Building module",project.sourceFolder()
project.buildSystem.build(reconfigure=args.reconfigure)
print
diff --git
a/vcs.py
b/vcs.py
index e30d31a9cb4d24e02483ea0cd261ae7eb4544267..0931bebf7963958e1c499c074a8c6742daf4a7be 100644
(file)
--- a/
vcs.py
+++ b/
vcs.py
@@
-13,7
+13,7
@@
class Git:
def update(self, op_code, cur_count, max_count=None, message=''):
print self._cur_line+(" "*30)+"\r",
def update(self, op_code, cur_count, max_count=None, message=''):
print self._cur_line+(" "*30)+"\r",
- def update(self):
+ def update(self
, forceVersion=False
):
isBranch = (self.commit.startswith('origin/'))
if isBranch:
branchname = self.commit[len('origin/'):]
isBranch = (self.commit.startswith('origin/'))
if isBranch:
branchname = self.commit[len('origin/'):]
@@
-41,7
+41,10
@@
class Git:
branch.set_tracking_branch(origin.refs[branchname])
# update it to the latest remote commit
branch.checkout()
branch.set_tracking_branch(origin.refs[branchname])
# update it to the latest remote commit
branch.checkout()
- repo.git.rebase(self.commit)
+ if forceVersion:
+ repo.head.reset(self.commit, working_tree=True)
+ else:
+ repo.git.rebase(self.commit)
print "...done",
if repo.head.reference.commit != repo.commit(self.commit):
print "(keeping local patches around)",
print "...done",
if repo.head.reference.commit != repo.commit(self.commit):
print "(keeping local patches around)",
@@
-60,9
+63,10
@@
class SVN:
self.url = url
self.versionName = versionName
self.url = url
self.versionName = versionName
- def update(self):
+ def update(self
, forceVersion=False
):
if os.path.exists(self.folder):
os.chdir(self.folder) # go into repository
if os.path.exists(self.folder):
os.chdir(self.folder) # go into repository
+ if forceVersion: subprocess.check_call(['svn', 'revert', '-R', '.'])
subprocess.check_call(['svn', 'switch', self.url]) # and update to the URL we got
else:
subprocess.check_call(['svn', 'co', self.url, self.folder]) # just download it
subprocess.check_call(['svn', 'switch', self.url]) # and update to the URL we got
else:
subprocess.check_call(['svn', 'co', self.url, self.folder]) # just download it