mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 20:59:01 +02:00
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>
This commit is contained in:
parent
ce25644664
commit
fe717e0ad1
|
@ -137,7 +137,6 @@ def main():
|
||||||
help = "Hide all output except error messages",
|
help = "Hide all output except error messages",
|
||||||
action="store_const", const=logging.ERROR, dest="loglevel")
|
action="store_const", const=logging.ERROR, dest="loglevel")
|
||||||
|
|
||||||
|
|
||||||
options, args = parser.parse_args(sys.argv)
|
options, args = parser.parse_args(sys.argv)
|
||||||
if len(args) > 1:
|
if len(args) > 1:
|
||||||
logger.error('unexpected argument "%s"' % args[1])
|
logger.error('unexpected argument "%s"' % args[1])
|
||||||
|
@ -256,7 +255,10 @@ def main():
|
||||||
repo = git.Repo(repodir)
|
repo = git.Repo(repodir)
|
||||||
assert repo.bare == False
|
assert repo.bare == False
|
||||||
try:
|
try:
|
||||||
topcommit = repo.commit('origin/%s' % branchname)
|
if options.nocheckout:
|
||||||
|
topcommit = repo.commit('HEAD')
|
||||||
|
else:
|
||||||
|
topcommit = repo.commit('origin/%s' % branchname)
|
||||||
except:
|
except:
|
||||||
if layerbranch:
|
if layerbranch:
|
||||||
logger.error("Failed update of layer %s - branch %s no longer exists" % (layer.name, branchdesc))
|
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.layerbranch = layerbranch
|
||||||
dep.save()
|
dep.save()
|
||||||
|
|
||||||
if layerbranch.vcs_subdir:
|
if layerbranch.vcs_subdir and not options.nocheckout:
|
||||||
# Find latest commit in subdirectory
|
# Find latest commit in subdirectory
|
||||||
# A bit odd to do it this way but apparently there's no other way in the GitPython API
|
# 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):
|
for commit in repo.iter_commits('origin/%s' % options.branch, paths=layerbranch.vcs_subdir):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user