[09/11] support/download: implement source-check in bzr backend
diff mbox series

Message ID 20190103204026.23512-10-patrickdepinguin@gmail.com
State Superseded
Headers show
Series
  • support/download: fix scp and reintroduce source-check
Related show

Commit Message

Thomas De Schampheleire Jan. 3, 2019, 8:40 p.m. UTC
From: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>

The implementation is the same as originally was present.
It suffers from the disadvantage that an invalid revision on a valid URL
will not be detected.
If someone is proficient in bzr-speak, please improve.

Signed-off-by: Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
---
 support/download/bzr | 9 +++++++++
 1 file changed, 9 insertions(+)

Patch
diff mbox series

diff --git a/support/download/bzr b/support/download/bzr
index 5289a421cd..2f13a607c9 100755
--- a/support/download/bzr
+++ b/support/download/bzr
@@ -7,6 +7,7 @@  set -e
 #
 # Options:
 #   -q          Be quiet
+#   -C          Only check that the changeset exists in the remote repository
 #   -o FILE     Generate archive in FILE.
 #   -u URI      Clone from repository at URI.
 #   -c CSET     Use changeset (or revision) CSET.
@@ -20,6 +21,7 @@  verbose=
 while getopts "${BR_BACKEND_DL_GETOPTS}" OPT; do
     case "${OPT}" in
     q)  verbose=-q;;
+    C)  checkonly=1;;
     o)  output="${OPTARG}";;
     u)  uri="${OPTARG}";;
     c)  cset="${OPTARG}";;
@@ -37,6 +39,13 @@  _bzr() {
     eval ${BZR} "${@}"
 }
 
+if [ -n "${checkonly}" ]; then
+    # TODO this check only checks that the remote repository exists, not that
+    # it actually contains the requested revision.
+    _bzr ls --quiet "${@}" "'${uri}'" > /dev/null
+    exit ${?}
+fi
+
 # --per-file-timestamps comes with bzr-2.2 (released August 2010),
 # so only pass it if bzr is recent enough. We compute versions as:
 # major*1000 + minor