aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2013-09-18 21:03:56 +0100
committerPaul Eggleton <paul.eggleton@linux.intel.com>2013-09-20 07:08:22 +0100
commitfe717e0ad131aa85a000f899e005668ae102316f (patch)
treeef527f27371512b24eb9f8b902f01e53ba5a035d
parentce25644664c904dfc63d3b4fa72dbeff4015c743 (diff)
downloadopenembedded-core-contrib-fe717e0ad131aa85a000f899e005668ae102316f.tar.gz
openembedded-core-contrib-fe717e0ad131aa85a000f899e005668ae102316f.tar.bz2
openembedded-core-contrib-fe717e0ad131aa85a000f899e005668ae102316f.zip
update.py: fix ability to test updating with --nocheckout
In order to test updating we need to be able to check out a previous revision of the repository and have the update script load from that without checking out the latest revision, so fix the --nocheckout option to work properly. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
-rwxr-xr-xlayerindex/update.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/layerindex/update.py b/layerindex/update.py
index 7067044c81..f43b260bb2 100755
--- a/layerindex/update.py
+++ b/layerindex/update.py
@@ -137,7 +137,6 @@ def main():
help = "Hide all output except error messages",
action="store_const", const=logging.ERROR, dest="loglevel")
-
options, args = parser.parse_args(sys.argv)
if len(args) > 1:
logger.error('unexpected argument "%s"' % args[1])
@@ -256,7 +255,10 @@ def main():
repo = git.Repo(repodir)
assert repo.bare == False
try:
- topcommit = repo.commit('origin/%s' % branchname)
+ if options.nocheckout:
+ topcommit = repo.commit('HEAD')
+ else:
+ topcommit = repo.commit('origin/%s' % branchname)
except:
if layerbranch:
logger.error("Failed update of layer %s - branch %s no longer exists" % (layer.name, branchdesc))
@@ -286,7 +288,7 @@ def main():
dep.layerbranch = layerbranch
dep.save()
- if layerbranch.vcs_subdir:
+ if layerbranch.vcs_subdir and not options.nocheckout:
# Find latest commit in subdirectory
# A bit odd to do it this way but apparently there's no other way in the GitPython API
for commit in repo.iter_commits('origin/%s' % options.branch, paths=layerbranch.vcs_subdir):