[wstool] 01/03: Imported Upstream version 0.1.9
Jochen Sprickerhof
jspricke-guest at moszumanska.debian.org
Sun Sep 13 17:06:02 UTC 2015
This is an automated email from the git hooks/post-receive script.
jspricke-guest pushed a commit to branch master
in repository wstool.
commit c58e57f57c6f74fb3ea155467e5a9b531408e445
Author: Jochen Sprickerhof <git at jochen.sprickerhof.de>
Date: Sun Sep 13 18:57:56 2015 +0200
Imported Upstream version 0.1.9
---
.travis.yml | 1 +
MANIFEST.in | 2 +
completion/_wstool | 40 +++++
completion/wstool-completion.bash | 242 ++++++++++++++++++++++++++++++
doc/Makefile | 182 +++++++++++++++++++++++
doc/changelog.rst | 23 +++
doc/conf.py | 270 ++++++++++++++++++++++++++++++++++
doc/developers_guide.rst | 82 +++++++++++
doc/index.rst | 77 ++++++++++
doc/make.bat | 242 ++++++++++++++++++++++++++++++
doc/rosinstall_file_format.rst | 37 +++++
doc/wstool_usage.rst | 267 +++++++++++++++++++++++++++++++++
setup.py | 85 ++++++++++-
src/wstool/__version__.py | 2 +-
src/wstool/cli_common.py | 89 ++++++-----
src/wstool/common.py | 2 +-
src/wstool/config_elements.py | 11 +-
src/wstool/config_yaml.py | 15 +-
src/wstool/multiproject_cli.py | 140 +++++++++++++++++-
src/wstool/multiproject_cmd.py | 88 ++++++++---
src/wstool/wstool_cli.py | 1 +
stdeb.cfg | 4 +-
test/local/mock_client.py | 10 +-
test/local/test_cli.py | 49 ++++--
test/local/test_diff_functions_git.py | 98 +++++++++---
test/local/test_diff_functions_hg.py | 8 +-
test/local/test_diff_functions_svn.py | 8 +-
test/scm_test_base.py | 4 +-
28 files changed, 1970 insertions(+), 109 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index 6c95bbf..90893b6 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -4,6 +4,7 @@ python:
- "2.7"
- "3.2"
- "3.3"
+ - "3.4"
# command to install dependencies
install:
# develop seems to be required by travis since 02/2013
diff --git a/MANIFEST.in b/MANIFEST.in
new file mode 100644
index 0000000..1474552
--- /dev/null
+++ b/MANIFEST.in
@@ -0,0 +1,2 @@
+recursive-include completion *
+recursive-include doc *
diff --git a/completion/_wstool b/completion/_wstool
new file mode 100644
index 0000000..555ecdc
--- /dev/null
+++ b/completion/_wstool
@@ -0,0 +1,40 @@
+#compdef wstool
+# Software License Agreement (BSD License)
+#
+# Copyright (c) 2010, Willow Garage, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+# * Neither the name of Willow Garage, Inc. nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+_wstool () {
+ local e
+ e=$(dirname ${funcsourcetrace[1]%:*})/wstool-completion.bash
+ if [ -f $e ]; then
+ . $e
+ fi
+}
diff --git a/completion/wstool-completion.bash b/completion/wstool-completion.bash
new file mode 100644
index 0000000..37cfe5f
--- /dev/null
+++ b/completion/wstool-completion.bash
@@ -0,0 +1,242 @@
+# Software License Agreement (BSD License)
+#
+# Copyright (c) 2010, Willow Garage, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following
+# disclaimer in the documentation and/or other materials provided
+# with the distribution.
+# * Neither the name of Willow Garage, Inc. nor the names of its
+# contributors may be used to endorse or promote products derived
+# from this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
+# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
+# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+
+# Programmable completion for the wstool command under bash. Source
+# this file (or on some systems add it to ~/.bash_completion and start a new
+# shell)
+
+# ZSH support
+if [[ -n ${ZSH_VERSION-} ]]; then
+ autoload -U +X bashcompinit && bashcompinit
+fi
+
+# put here to be extendable
+if [ -z "$WSTOOL_BASE_COMMANDS" ]; then
+ _WSTOOL_BASE_COMMANDS="help init set merge info remove diff status update --version"
+fi
+
+# Based originally on the bzr/svn bash completition scripts.
+_wstool_complete()
+{
+ local cur cmds cmdOpts opt helpCmds optBase i
+
+ COMPREPLY=()
+ cur=${COMP_WORDS[COMP_CWORD]}
+
+ cmds=$_WSTOOL_BASE_COMMANDS
+
+ if [[ $COMP_CWORD -eq 1 ]] ; then
+ COMPREPLY=( $( compgen -W "$cmds" -- $cur ) )
+ return 0
+ fi
+
+ # if not typing an option, or if the previous option required a
+ # parameter, then fallback on ordinary filename expansion
+ helpCmds='help|--help|h|\?'
+ if [[ ${COMP_WORDS[1]} != @@($helpCmds) ]] && \
+ [[ "$cur" != -* ]] ; then
+ case ${COMP_WORDS[1]} in
+ info|diff|di|status|st|remove|rm|update|up)
+ cmdOpts=`wstool info --only=localname 2> /dev/null | sed 's,:, ,g'`
+ COMPREPLY=( $( compgen -W "$cmdOpts" -- $cur ) )
+ ;;
+ set)
+ if [[ $COMP_CWORD -eq 2 ]]; then
+ cmdOpts=`wstool info --only=localname 2> /dev/null | sed 's,:, ,g'`
+ COMPREPLY=( $( compgen -W "$cmdOpts" -- $cur ) )
+ elif [[ $COMP_CWORD -eq 3 ]]; then
+ cmdOpts=`wstool info ${COMP_WORDS[2]} --only=uri 2> /dev/null`
+ COMPREPLY=( $( compgen -W "$cmdOpts" -- $cur ) )
+ else
+ if [[ ${COMP_WORDS[$(( $COMP_CWORD - 1 ))]} == "--version-new" ]]; then
+ cmdOpts=`wstool info ${COMP_WORDS[2]} --only=version 2> /dev/null|sed 's/,$//'`
+ COMPREPLY=( $( compgen -W "$cmdOpts" -- $cur ) )
+ fi
+ fi
+ ;;
+ esac
+ return 0
+ fi
+
+ cmdOpts=
+ case ${COMP_WORDS[1]} in
+ status|st)
+ cmdOpts="-t --target-workspace --untracked"
+ ;;
+ diff|di)
+ cmdOpts="-t --target-workspace"
+ ;;
+ init)
+ cmdOpts="-t --target-workspace --continue-on-error"
+ ;;
+ merge)
+ cmdOpts="-t --target-workspace -y --confirm-all -r --merge-replace -k --merge-keep -a --merge-kill-append"
+ ;;
+ set)
+ cmdOpts="-t --target-workspace --git --svn --bzr --hg --uri -v --version-new --detached -y --confirm"
+ ;;
+ remove|rm)
+ cmdOpts="-t --target-workspace"
+ ;;
+ update|up)
+ cmdOpts="-t --target-workspace --delete-changed-uris --abort-changed-uris --backup-changed-uris"
+ ;;
+ snapshot)
+ cmdOpts="-t --target-workspace"
+ ;;
+ info)
+ cmdOpts="-t --target-workspace --data-only --no-pkg-path --pkg-path-only --only --yaml"
+ ;;
+ *)
+ ;;
+ esac
+
+ cmdOpts="$cmdOpts --help -h"
+
+ # take out options already given
+ for (( i=2; i<=$COMP_CWORD-1; ++i )) ; do
+ opt=${COMP_WORDS[$i]}
+
+ case $opt in
+ --*) optBase=${opt/=*/} ;;
+ -*) optBase=${opt:0:2} ;;
+ esac
+
+ cmdOpts=" $cmdOpts "
+ cmdOpts=${cmdOpts/ ${optBase} / }
+
+ # take out alternatives
+ case $optBase in
+ -h) cmdOpts=${cmdOpts/ --help / } ;;
+ --help) cmdOpts=${cmdOpts/ -h / } ;;
+ -t) cmdOpts=${cmdOpts/ --target-workspace / } ;;
+ --target-workspace) cmdOpts=${cmdOpts/ -t / } ;;
+ --delete-changed-uris)
+ cmdOpts=${cmdOpts/ --abort-changed-uris / }
+ cmdOpts=${cmdOpts/ --backup-changed-uris / }
+ ;;
+ --abort-changed-uris)
+ cmdOpts=${cmdOpts/ --delete-changed-uris / }
+ cmdOpts=${cmdOpts/ --backup-changed-uris / }
+ ;;
+ --backup-changed-uris)
+ cmdOpts=${cmdOpts/ --delete-changed-uris / }
+ cmdOpts=${cmdOpts/ --abort-changed-uris / }
+ ;;
+ # scm options
+ --svn)
+ cmdOpts=${cmdOpts/ --git / }
+ cmdOpts=${cmdOpts/ --hg / }
+ cmdOpts=${cmdOpts/ --bzr / }
+ cmdOpts=${cmdOpts/ --detached / }
+ ;;
+ --git)
+ cmdOpts=${cmdOpts/ --svn / }
+ cmdOpts=${cmdOpts/ --hg / }
+ cmdOpts=${cmdOpts/ --bzr / }
+ cmdOpts=${cmdOpts/ --detached / }
+ ;;
+ --hg)
+ cmdOpts=${cmdOpts/ --git / }
+ cmdOpts=${cmdOpts/ --svn / }
+ cmdOpts=${cmdOpts/ --bzr / }
+ cmdOpts=${cmdOpts/ --detached / }
+ ;;
+ --bzr)
+ cmdOpts=${cmdOpts/ --git / }
+ cmdOpts=${cmdOpts/ --hg / }
+ cmdOpts=${cmdOpts/ --svn / }
+ cmdOpts=${cmdOpts/ --detached / }
+ ;;
+ --detached)
+ cmdOpts=${cmdOpts/ --git / }
+ cmdOpts=${cmdOpts/ --hg / }
+ cmdOpts=${cmdOpts/ --bzr / }
+ cmdOpts=${cmdOpts/ --svn / }
+ ;;
+ # merge options
+ --merge-replace)
+ cmdOpts=${cmdOpts/ --merge-keep / }
+ cmdOpts=${cmdOpts/ --merge-kill-append / }
+ cmdOpts=${cmdOpts/ -r / }
+ cmdOpts=${cmdOpts/ -a / }
+ cmdOpts=${cmdOpts/ -k / }
+ ;;
+ --merge-keep)
+ cmdOpts=${cmdOpts/ --merge-replace / }
+ cmdOpts=${cmdOpts/ --merge-kill-append / }
+ cmdOpts=${cmdOpts/ -r / }
+ cmdOpts=${cmdOpts/ -a / }
+ cmdOpts=${cmdOpts/ -k / }
+ ;;
+ --merge-kill-append)
+ cmdOpts=${cmdOpts/ --merge-keep / }
+ cmdOpts=${cmdOpts/ --merge-replace / }
+ cmdOpts=${cmdOpts/ -r / }
+ cmdOpts=${cmdOpts/ -a / }
+ cmdOpts=${cmdOpts/ -k / }
+ ;;
+ -r)
+ cmdOpts=${cmdOpts/ --merge-keep / }
+ cmdOpts=${cmdOpts/ --merge-kill-append / }
+ cmdOpts=${cmdOpts/ --merge-replace / }
+ cmdOpts=${cmdOpts/ -a / }
+ cmdOpts=${cmdOpts/ -k / }
+ ;;
+ -a)
+ cmdOpts=${cmdOpts/ --merge-keep / }
+ cmdOpts=${cmdOpts/ --merge-kill-append / }
+ cmdOpts=${cmdOpts/ --merge-replace / }
+ cmdOpts=${cmdOpts/ -r / }
+ cmdOpts=${cmdOpts/ -k / }
+ ;;
+ -k)
+ cmdOpts=${cmdOpts/ --merge-keep / }
+ cmdOpts=${cmdOpts/ --merge-kill-append / }
+ cmdOpts=${cmdOpts/ --merge-replace / }
+ cmdOpts=${cmdOpts/ -a / }
+ cmdOpts=${cmdOpts/ -r / }
+ ;;
+ esac
+
+ # skip next option if this one requires a parameter
+ if [[ $opt == @@($optsParam) ]] ; then
+ ((++i))
+ fi
+ done
+
+ COMPREPLY=( $( compgen -W "$cmdOpts" -- $cur ) )
+
+ return 0
+
+}
+complete -F _wstool_complete -o default wstool
diff --git a/doc/Makefile b/doc/Makefile
new file mode 100644
index 0000000..090cdce
--- /dev/null
+++ b/doc/Makefile
@@ -0,0 +1,182 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS =
+SPHINXBUILD = sphinx-build
+PAPER =
+BUILDDIR = _build
+
+# User-friendly check for sphinx-build
+ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
+$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
+endif
+
+# Internal variables.
+PAPEROPT_a4 = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+# the i18n builder cannot share the environment and doctrees with the others
+I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
+
+help:
+ @echo "Please use \`make <target>' where <target> is one of"
+ @echo " html to make standalone HTML files"
+ @echo " dirhtml to make HTML files named index.html in directories"
+ @echo " singlehtml to make a single large HTML file"
+ @echo " pickle to make pickle files"
+ @echo " json to make JSON files"
+ @echo " htmlhelp to make HTML files and a HTML help project"
+ @echo " qthelp to make HTML files and a qthelp project"
+ @echo " devhelp to make HTML files and a Devhelp project"
+ @echo " epub to make an epub"
+ @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+ @echo " latexpdf to make LaTeX files and run them through pdflatex"
+ @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
+ @echo " text to make text files"
+ @echo " man to make manual pages"
+ @echo " texinfo to make Texinfo files"
+ @echo " info to make Texinfo files and run them through makeinfo"
+ @echo " gettext to make PO message catalogs"
+ @echo " changes to make an overview of all changed/added/deprecated items"
+ @echo " xml to make Docutils-native XML files"
+ @echo " pseudoxml to make pseudoxml-XML files for display purposes"
+ @echo " linkcheck to check all external links for integrity"
+ @echo " doctest to run all doctests embedded in the documentation (if enabled)"
+
+clean:
+ rm -rf $(BUILDDIR)/*
+
+html:
+ $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+dirhtml:
+ $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+singlehtml:
+ $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+ @echo
+ @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+
+pickle:
+ $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+ @echo
+ @echo "Build finished; now you can process the pickle files."
+
+json:
+ $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+ @echo
+ @echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+ $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+ @echo
+ @echo "Build finished; now you can run HTML Help Workshop with the" \
+ ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+ $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+ @echo
+ @echo "Build finished; now you can run "qcollectiongenerator" with the" \
+ ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+ @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/wstool.qhcp"
+ @echo "To view the help file:"
+ @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/wstool.qhc"
+
+devhelp:
+ $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
+ @echo
+ @echo "Build finished."
+ @echo "To view the help file:"
+ @echo "# mkdir -p $$HOME/.local/share/devhelp/wstool"
+ @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/wstool"
+ @echo "# devhelp"
+
+epub:
+ $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+ @echo
+ @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+
+latex:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo
+ @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+ @echo "Run \`make' in that directory to run these through (pdf)latex" \
+ "(use \`make latexpdf' here to do that automatically)."
+
+latexpdf:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo "Running LaTeX files through pdflatex..."
+ $(MAKE) -C $(BUILDDIR)/latex all-pdf
+ @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+latexpdfja:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo "Running LaTeX files through platex and dvipdfmx..."
+ $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
+ @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+text:
+ $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
+ @echo
+ @echo "Build finished. The text files are in $(BUILDDIR)/text."
+
+man:
+ $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+ @echo
+ @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
+
+texinfo:
+ $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+ @echo
+ @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
+ @echo "Run \`make' in that directory to run these through makeinfo" \
+ "(use \`make info' here to do that automatically)."
+
+info:
+ $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+ @echo "Running Texinfo files through makeinfo..."
+ make -C $(BUILDDIR)/texinfo info
+ @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
+
+gettext:
+ $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
+ @echo
+ @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
+
+changes:
+ $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+ @echo
+ @echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+ $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+ @echo
+ @echo "Link check complete; look for any errors in the above output " \
+ "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+ $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+ @echo "Testing of doctests in the sources finished, look at the " \
+ "results in $(BUILDDIR)/doctest/output.txt."
+
+upload: html
+ # set write permission for group so that everybody can overwrite existing files on the webserver
+ chmod -R g+w _build/html/
+ scp -pr _build/html/ rosbot at ros.osuosl.org:/home/rosbot/docs/independent/api/wstool
+
+xml:
+ $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
+ @echo
+ @echo "Build finished. The XML files are in $(BUILDDIR)/xml."
+
+pseudoxml:
+ $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
+ @echo
+ @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
diff --git a/doc/changelog.rst b/doc/changelog.rst
index 22852f1..3b8af1c 100644
--- a/doc/changelog.rst
+++ b/doc/changelog.rst
@@ -1,3 +1,26 @@
+0.1.9
+-----
+
+- Fix for zsh completion.
+- Fixed version dependency on vcstools for debian.
+
+0.1.8
+-----
+
+- Fix for installation issue.
+
+0.1.7
+-----
+
+- Added installation of generated man pages.
+- Added installation of shell completion for wstool.
+- Improved output of wstool info with the new get_current_version_label in vcstools.
+- Added a foreach command.
+- Added a ``--root`` option to wstool info.
+- Enhanced the ``--update`` option for wstool set.
+- Now uses multiple threads for network operations by default.
+- Some other minor fixes and improvements and docs.
+
0.1.5
-----
diff --git a/doc/conf.py b/doc/conf.py
new file mode 100644
index 0000000..c75ee09
--- /dev/null
+++ b/doc/conf.py
@@ -0,0 +1,270 @@
+# -*- coding: utf-8 -*-
+#
+# wstool documentation build configuration file, created by
+# sphinx-quickstart on Tue Aug 11 08:44:18 2015.
+#
+# This file is execfile()d with the current directory set to its
+# containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+
+import sys
+import os
+
+import imp
+
+file = None
+try:
+ file, pathname, description = imp.find_module('__version__', ['../src/wstool'])
+ vermod = imp.load_module('__version__', file, pathname, description)
+ version = vermod.version
+finally:
+ if file is not None:
+ file.close()
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+
+# -- General configuration ------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+# needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be extensions
+# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
+extensions = ['sphinx.ext.intersphinx']
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+# source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'wstool'
+copyright = u'2011, Willow Garage'
+
+# The version info for the project you're documenting, acts as replacement for
+# |version| and |release|, also used in various other places throughout the
+# built documents.
+#
+# The short X.Y version.
+version = version
+# The full version, including alpha/beta/rc tags.
+release = version
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+# language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+# today = ''
+# Else, today_fmt is used as the format for a strftime call.
+# today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = ['_build']
+
+# The reST default role (used for this markup: `text`) to use for all documents.
+# default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+# add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+# add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+# show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+# modindex_common_prefix = []
+
+
+# -- Options for HTML output ---------------------------------------------
+
+# The theme to use for HTML and HTML Help pages. See the documentation for
+# a list of builtin themes.
+html_theme = 'haiku'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further. For a list of options available for each theme, see the
+# documentation.
+# html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+# html_theme_path = []
+
+# The name for this set of Sphinx documents. If None, it defaults to
+# "<project> v<release> documentation".
+# html_title = None
+
+# A shorter title for the navigation bar. Default is the same as html_title.
+# html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+# html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+# html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# Add any extra paths that contain custom files (such as robots.txt or
+# .htaccess) here, relative to this directory. These files are copied
+# directly to the root of the documentation.
+#html_extra_path = []
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+# html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+# html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+# html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+# html_additional_pages = {}
+
+# If false, no module index is generated.
+# html_domain_indices = True
+
+# If false, no index is generated.
+# html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+# html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+# html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+# html_show_sphinx = True
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+# html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a <link> tag referring to it. The value of this option must be the
+# base URL from which the finished HTML is served.
+# html_use_opensearch = ''
+
+# This is the file name suffix for HTML files (e.g. ".xhtml").
+# html_file_suffix = None
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'wstooldoc'
+
+
+# -- Options for LaTeX output ---------------------------------------------
+
+latex_elements = {
+# The paper size ('letterpaper' or 'a4paper').
+#'papersize': 'letterpaper',
+
+# The font size ('10pt', '11pt' or '12pt').
+#'pointsize': '10pt',
+
+# Additional stuff for the LaTeX preamble.
+#'preamble': '',
+}
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title,
+# author, documentclass [howto, manual, or own class]).
+latex_documents = [
+ ('index', 'wstool.tex', u'wstool Documentation',
+ u'Tully Foote, Thibault Kruse, Ken Conley, Brian Gerkey', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+# latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+# latex_use_parts = False
+
+# If true, show page references after internal links.
+# latex_show_pagerefs = False
+
+# If true, show URL addresses after external links.
+# latex_show_urls = False
+
+# Additional stuff for the LaTeX preamble.
+# latex_preamble = ''
+
+# Documents to append as an appendix to all manuals.
+# latex_appendices = []
+
+# If false, no module index is generated.
+# latex_domain_indices = True
+
+
+# -- Options for manual page output ---------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+ ('index', 'wstool', u'wstool Documentation',
+ [u'Tully Foote, Thibault Kruse, Ken Conley, Brian Gerkey'], 1)
+]
+
+# If true, show URL addresses after external links.
+#man_show_urls = False
+
+
+# -- Options for Texinfo output -------------------------------------------
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+# dir menu entry, description, category)
+texinfo_documents = [
+ ('index', 'wstool', u'wstool Documentation',
+ u'Tully Foote, Thibault Kruse, Ken Conley, Brian Gerkey', 'wstool', 'One line description of project.',
+ 'Miscellaneous'),
+]
+
+# Documents to append as an appendix to all manuals.
+#texinfo_appendices = []
+
+# If false, no module index is generated.
+#texinfo_domain_indices = True
+
+# How to display URL addresses: 'footnote', 'no', or 'inline'.
+#texinfo_show_urls = 'footnote'
+
+# If true, do not generate a @detailmenu in the "Top" node's menu.
+#texinfo_no_detailmenu = False
+
+
+# Example configuration for intersphinx: refer to the Python standard library.
+intersphinx_mapping = {'http://docs.python.org/': None}
diff --git a/doc/developers_guide.rst b/doc/developers_guide.rst
new file mode 100644
index 0000000..417200c
--- /dev/null
+++ b/doc/developers_guide.rst
@@ -0,0 +1,82 @@
+Developer's Guide
+=================
+
+Changelog
+---------
+
+.. toctree::
+ :maxdepth: 1
+
+ changelog
+
+Bug reports and feature requests
+--------------------------------
+
+- `Submit a bug report <https://github.com/vcstools/wstool/issues>`_
+
+Developer Setup
+---------------
+
+The wstool source can be downloaded using Mercurial::
+
+ $ git clone https://github.com/vcstools/wstool.git
+
+You will also need vcstools, which you can either install using pip or download using::
+
+ $ git clone https://github.com/vcstools/vcstools.git
+ $ cd vcstools
+ $ python develop
+
+
+wstool uses `setuptools <http://pypi.python.org/pypi/setuptools>`_,
+which you will need to download and install in order to run the
+packaging. We use setuptools instead of distutils in order to be able
+use ``setup()`` keys like ``install_requires``.
+
+Configure your environment:
+
+ $ cd wstool
+ $ python develop
+
+Testing
+-------
+
+Install test dependencies
+
+::
+
+ $ pip install nose
+ $ pip install mock
+
+
+wstool uses `Python nose
+<http://readthedocs.org/docs/nose/en/latest/>`_ for testing, which is
+a fairly simple and straightforward test framework. The wstool
+mainly use :mod:`unittest` to construct test fixtures, but with nose
+you can also just write a function that starts with the name ``test``
+and use normal ``assert`` statements.
+
+wstool also uses `mock <http://www.voidspace.org.uk/python/mock/>`_
+to create mocks for testing.
+
+You can run the tests, including coverage, as follows:
+
+::
+
+ $ cd wstool
+ $ make test
+
+
+Documentation
+-------------
+
+Sphinx is used to provide API documentation for wstool. The documents
+are stored in the ``doc`` sub-directory.
+
+You can build the docs as follows:
+
+::
+
+ $ cd wstool/doc
+ $ make html
+
diff --git a/doc/index.rst b/doc/index.rst
new file mode 100644
index 0000000..2cad196
--- /dev/null
+++ b/doc/index.rst
@@ -0,0 +1,77 @@
+wstool
+======
+
+.. module:: wstool
+.. moduleauthor:: Tully Foote <tfoote at willowgarage.com>, Thibault Kruse <kruset at in.tum.de>, Ken Conley <kwc at willowgarage.com>
+
+Using wstool you can update several folders using a variety
+of SCMs (SVN, Mercurial, git, Bazaar) with just one command.
+
+That way you can more effectively manage source code workspaces.
+
+The wstool package provides a Python API for interacting with a
+source code workspace as well as a group of command line tools.
+Rosinstall leverages the :mod:`vcstools` package for source control and
+stores its state in .rosinstall files.
+
+
+Command Line Tools:
+===================
+.. toctree::
+ :maxdepth: 2
+
+ wstool_usage
+
+
+Installation
+============
+
+Ubuntu
+------
+
+On Ubuntu the recommended way to install rosinstall is to use apt.
+
+::
+
+ sudo apt-get install python-wstool
+
+Other Platforms
+---------------
+
+On other platforms rosinstall is available on pypi and can be installed via ``pip``
+::
+
+ pip install -U wstool
+
+or ``easy_install``:
+
+::
+
+ easy_install -U wstool vcstools
+
+
+
+
+Rosinstall File Format:
+=======================
+.. toctree::
+ :maxdepth: 2
+
+ rosinstall_file_format
+
+
+Advanced: rosinstall developers/contributors
+============================================
+
+.. toctree::
+ :maxdepth: 2
+
+ developers_guide
+
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
diff --git a/doc/make.bat b/doc/make.bat
new file mode 100644
index 0000000..3cd57bf
--- /dev/null
+++ b/doc/make.bat
@@ -0,0 +1,242 @@
+ at ECHO OFF
+
+REM Command file for Sphinx documentation
+
+if "%SPHINXBUILD%" == "" (
+ set SPHINXBUILD=sphinx-build
+)
+set BUILDDIR=build
+set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source
+set I18NSPHINXOPTS=%SPHINXOPTS% source
+if NOT "%PAPER%" == "" (
+ set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
+ set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
+)
+
+if "%1" == "" goto help
+
+if "%1" == "help" (
+ :help
+ echo.Please use `make ^<target^>` where ^<target^> is one of
+ echo. html to make standalone HTML files
+ echo. dirhtml to make HTML files named index.html in directories
+ echo. singlehtml to make a single large HTML file
+ echo. pickle to make pickle files
+ echo. json to make JSON files
+ echo. htmlhelp to make HTML files and a HTML help project
+ echo. qthelp to make HTML files and a qthelp project
+ echo. devhelp to make HTML files and a Devhelp project
+ echo. epub to make an epub
+ echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
+ echo. text to make text files
+ echo. man to make manual pages
+ echo. texinfo to make Texinfo files
+ echo. gettext to make PO message catalogs
+ echo. changes to make an overview over all changed/added/deprecated items
+ echo. xml to make Docutils-native XML files
+ echo. pseudoxml to make pseudoxml-XML files for display purposes
+ echo. linkcheck to check all external links for integrity
+ echo. doctest to run all doctests embedded in the documentation if enabled
+ goto end
+)
+
+if "%1" == "clean" (
+ for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
+ del /q /s %BUILDDIR%\*
+ goto end
+)
+
+
+%SPHINXBUILD% 2> nul
+if errorlevel 9009 (
+ echo.
+ echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
+ echo.installed, then set the SPHINXBUILD environment variable to point
+ echo.to the full path of the 'sphinx-build' executable. Alternatively you
+ echo.may add the Sphinx directory to PATH.
+ echo.
+ echo.If you don't have Sphinx installed, grab it from
+ echo.http://sphinx-doc.org/
+ exit /b 1
+)
+
+if "%1" == "html" (
+ %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The HTML pages are in %BUILDDIR%/html.
+ goto end
+)
+
+if "%1" == "dirhtml" (
+ %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
+ goto end
+)
+
+if "%1" == "singlehtml" (
+ %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
+ goto end
+)
+
+if "%1" == "pickle" (
+ %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can process the pickle files.
+ goto end
+)
+
+if "%1" == "json" (
+ %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can process the JSON files.
+ goto end
+)
+
+if "%1" == "htmlhelp" (
+ %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can run HTML Help Workshop with the ^
+.hhp project file in %BUILDDIR%/htmlhelp.
+ goto end
+)
+
+if "%1" == "qthelp" (
+ %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can run "qcollectiongenerator" with the ^
+.qhcp project file in %BUILDDIR%/qthelp, like this:
+ echo.^> qcollectiongenerator %BUILDDIR%\qthelp\wstool.qhcp
+ echo.To view the help file:
+ echo.^> assistant -collectionFile %BUILDDIR%\qthelp\wstool.ghc
+ goto end
+)
+
+if "%1" == "devhelp" (
+ %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished.
+ goto end
+)
+
+if "%1" == "epub" (
+ %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The epub file is in %BUILDDIR%/epub.
+ goto end
+)
+
+if "%1" == "latex" (
+ %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
+ goto end
+)
+
+if "%1" == "latexpdf" (
+ %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+ cd %BUILDDIR%/latex
+ make all-pdf
+ cd %BUILDDIR%/..
+ echo.
+ echo.Build finished; the PDF files are in %BUILDDIR%/latex.
+ goto end
+)
+
+if "%1" == "latexpdfja" (
+ %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+ cd %BUILDDIR%/latex
+ make all-pdf-ja
+ cd %BUILDDIR%/..
+ echo.
+ echo.Build finished; the PDF files are in %BUILDDIR%/latex.
+ goto end
+)
+
+if "%1" == "text" (
+ %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The text files are in %BUILDDIR%/text.
+ goto end
+)
+
+if "%1" == "man" (
+ %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The manual pages are in %BUILDDIR%/man.
+ goto end
+)
+
+if "%1" == "texinfo" (
+ %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
+ goto end
+)
+
+if "%1" == "gettext" (
+ %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
+ goto end
+)
+
+if "%1" == "changes" (
+ %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.The overview file is in %BUILDDIR%/changes.
+ goto end
+)
+
+if "%1" == "linkcheck" (
+ %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Link check complete; look for any errors in the above output ^
+or in %BUILDDIR%/linkcheck/output.txt.
+ goto end
+)
+
+if "%1" == "doctest" (
+ %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Testing of doctests in the sources finished, look at the ^
+results in %BUILDDIR%/doctest/output.txt.
+ goto end
+)
+
+if "%1" == "xml" (
+ %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The XML files are in %BUILDDIR%/xml.
+ goto end
+)
+
+if "%1" == "pseudoxml" (
+ %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
+ goto end
+)
+
+:end
diff --git a/doc/rosinstall_file_format.rst b/doc/rosinstall_file_format.rst
new file mode 100644
index 0000000..228261d
--- /dev/null
+++ b/doc/rosinstall_file_format.rst
@@ -0,0 +1,37 @@
+rosinstall file format
+======================
+
+Format
+------
+
+The rosinstall file format is a yaml document. It is a list of
+top level dictionaries. Each top level dictionary is expected to have one of the vcs type keys and no other keys.
+
+Inside every top level dictionary there is one required key, ``local-name`` this represents the path where to install files. It will support both workspace relative paths as well as absolute paths.
+
+Each of the vcs type keys requires a ``uri`` key, and optionally takes a ``version`` key.
+
+Top Level Keys
+--------------
+The valid keys are ``svn``, ``hg``, ``git``, ``bzr``.
+
+Each key represents a form of version control system to use. These are supported from the vcstools module.
+
+Example rosinstall syntax:
+--------------------------
+
+Below is an example rosinstall syntax with examples of most of the
+possible permutations:
+
+::
+
+ - svn: {local-name: some/local/path2, uri: /some/local/uri}
+ - hg: {local-name: some/local/path3, uri: http://some/uri, version: 123}
+ - git: {local-name: /some/local/aboslute/path, uri: http://some/uri, version: 123}
+ - bzr: {local-name: some/local/path4, uri: http://some/uri, version: 123}
+
+Things to note are:
+
+ - ``version`` is optional though recommended.
+ - Absolute or relative paths are valid for ``local-name``
+ - ``uri`` can be a local file path to a repository.
diff --git a/doc/wstool_usage.rst b/doc/wstool_usage.rst
new file mode 100644
index 0000000..b716330
--- /dev/null
+++ b/doc/wstool_usage.rst
@@ -0,0 +1,267 @@
+wstool: A tool for managing source code workspaces
+==================================================
+
+wstool allows manipulation of a set of version-controlled folders as
+specified in a workspace definition file.
+
+.. contents:: Contents
+ :depth: 3
+
+
+Usage
+-----
+
+::
+
+ wstool is a command to manipulate multiple version controlled folders.
+
+ Official usage:
+ wstool CMD [ARGS] [OPTIONS]
+
+ wstool will try to infer install path from context
+
+ Type 'wstool help' for usage.
+ Options:
+ help provide help for commands
+ init set up a directory as workspace
+ set add or changes one entry from your workspace config
+ merge merges your workspace with another config set
+ remove (rm) remove an entry from your workspace config, without deleting files
+ update (up) update or check out some of your config elements
+ info Overview of some entries
+ status (st) print the change status of files in some SCM controlled entries
+ diff (di) print a diff over some SCM controlled entries
+
+
+init
+~~~~
+
+set up a directory as workspace
+
+wstool init does the following:
+
+ 1. Reads folder/file/web-uri SOURCE_PATH looking for a rosinstall yaml
+ 2. Creates new .rosinstall file at TARGET-PATH configured
+
+SOURCE_PATH can e.g. be a folder like /opt/ros/electric
+If PATH is not given, uses current folder.
+
+::
+
+ Usage: wstool init [TARGET_PATH [SOURCE_PATH]]?
+
+ Options::
+
+ -h, --help show this help message and exit
+ --continue-on-error Continue despite checkout errors
+ -j JOBS, --parallel=JOBS
+ How many parallel threads to use for installing
+
+Examples::
+
+ $ wstool init ~/jade /opt/ros/jade
+
+
+set
+~~~
+
+add or changes one entry from your workspace config
+The command will infer whether you want to add or modify an entry. If
+you modify, it will only change the details you provide, keeping
+those you did not provide. if you only provide a uri, will use the
+basename of it as localname unless such an element already exists.
+
+The command only changes the configuration, to checkout or update
+the element, run wstool update afterwards.
+
+::
+
+ Usage: wstool set [localname] [SCM-URI]? [--(detached|svn|hg|git|bzr)] [--version=VERSION]]
+
+ Options:
+ -h, --help show this help message and exit
+ --detached make an entry unmanaged (default for new element)
+ -v VERSION, --version-new=VERSION
+ point SCM to this version
+ --git make an entry a git entry
+ --svn make an entry a subversion entry
+ --hg make an entry a mercurial entry
+ --bzr make an entry a bazaar entry
+ -y, --confirm Do not ask for confirmation
+ -u, --update update repository after set
+ -t WORKSPACE, --target-workspace=WORKSPACE
+ which workspace to use
+
+Examples::
+
+ $ wstool set robot_model --hg https://kforge.ros.org/robotmodel/robot_model
+ $ wstool set robot_model --version robot_model-1.7.1
+ $ wstool set robot_model --detached
+
+
+
+merge
+~~~~~
+
+The command merges config with given other rosinstall element sets, from files
+or web uris.
+
+The default workspace will be inferred from context, you can specify one using
+-t.
+
+By default, when an element in an additional URI has the same
+local-name as an existing element, the existing element will be
+replaced. In order to ensure the ordering of elements is as
+provided in the URI, use the option ``--merge-kill-append``.
+
+::
+
+ Usage: wstool merge [URI] [OPTIONS]
+
+ Options:
+ -h, --help show this help message and exit
+ -a, --merge-kill-append
+ merge by deleting given entry and appending new one
+ -k, --merge-keep (default) merge by keeping existing entry and
+ discarding new one
+ -r, --merge-replace merge by replacing given entry with new one
+ maintaining ordering
+ -y, --confirm-all do not ask for confirmation unless strictly necessary
+ -t WORKSPACE, --target-workspace=WORKSPACE
+ which workspace to use
+
+Examples::
+
+ $ wstool merge someother.rosinstall
+
+You can use '-' to pipe in input, as an example::
+
+ $ roslocate info robot_mode | wstool merge -
+
+
+update
+~~~~~~
+
+update or check out some of your config elements
+
+This command calls the SCM provider to pull changes from remote to
+your local filesystem. In case the url has changed, the command will
+ask whether to delete or backup the folder.
+
+::
+
+ Usage: wstool update [localname]*
+
+ Options:
+ -h, --help show this help message and exit
+ --delete-changed-uris
+ Delete the local copy of a directory before changing
+ uri.
+ --abort-changed-uris Abort if changed uri detected
+ --continue-on-error Continue despite checkout errors
+ --backup-changed-uris=BACKUP_CHANGED
+ backup the local copy of a directory before changing
+ uri to this directory.
+ -j JOBS, --parallel=JOBS
+ How many parallel threads to use for installing
+ -v, --verbose Whether to print out more information
+ -t WORKSPACE, --target-workspace=WORKSPACE
+ which workspace to use
+
+
+Examples::
+
+ $ wstool update -t ~/jade
+ $ wstool update robot_model geometry
+
+
+
+info
+~~~~
+
+Overview of some entries
+
+The Status (S) column shows
+ x for missing
+ L for uncommited (local) changes
+ V for difference in version and/or remote URI
+ C for difference in local and remote versions
+
+The 'Version-Spec' column shows what tag, branch or revision was given
+in the .rosinstall file. The 'UID' column shows the unique ID of the
+current (and specified) version. The 'URI' column shows the configured
+URL of the repo.
+
+If status is V, the difference between what was specified and what is
+real is shown in the respective column. For SVN entries, the url is
+split up according to standard layout (trunk/tags/branches). The
+ROS_PACKAGE_PATH follows the order of the table, earlier entries
+overlay later entries.
+
+When given one localname, just show the data of one element in list
+form.
+This also has the generic properties element which is usually empty.
+
+The ``--only`` option accepts keywords: ['path', 'localname', 'version',
+'revision', 'cur_revision', 'uri', 'cur_uri', 'scmtype']
+
+::
+
+ Usage: wstool info [localname]* [OPTIONS]
+
+
+ Options:
+ -h, --help show this help message and exit
+ --root Show workspace root path
+ --data-only Does not provide explanations
+ --only=ONLY Shows comma-separated lists of only given comma-
+ separated attribute(s).
+ --yaml Shows only version of single entry. Intended for
+ scripting.
+ --fetch When used, retrieves version information from remote
+ (takes longer).
+ -u, --untracked Also show untracked files as modifications
+ -t WORKSPACE, --target-workspace=WORKSPACE
+ which workspace to use
+ -m, --managed-only only show managed elements
+
+Examples::
+
+ $ wstool info -t ~/ros/jade
+ $ wstool info robot_model
+ $ wstool info --yaml
+ $ wstool info --only=path,cur_uri,cur_revision robot_model geometry
+
+
+
+
+status
+~~~~~~
+
+print the change status of files in some SCM controlled entries. The status
+columns meanings are as the respective SCM defines them.
+
+::
+
+ Usage: wstool status [localname]*
+
+ Options:
+ -h, --help show this help message and exit
+ --untracked Also shows untracked files
+ -t WORKSPACE, --target-workspace=WORKSPACE
+ which workspace to use
+
+diff
+~~~~
+
+print a diff over some SCM controlled entries
+
+::
+
+ Usage: wstool diff [localname]*
+
+ Options:
+ -h, --help show this help message and exit
+ --untracked Also shows untracked files
+ -t WORKSPACE, --target-workspace=WORKSPACE
+ which workspace to use
diff --git a/setup.py b/setup.py
index 04f0a87..7a55b7d 100644
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,11 @@
from setuptools import setup
+from distutils.command.build import build
+from distutils.command.build_py import build_py
+import os
+import sys
import imp
+import argparse
def get_version():
@@ -15,12 +20,90 @@ def get_version():
ver_file.close()
+def _resolve_prefix(prefix, type):
+ osx_system_prefix = '/System/Library/Frameworks/Python.framework/Versions'
+ if type == 'man':
+ if prefix == '/usr':
+ return '/usr/share'
+ if sys.prefix.startswith(osx_system_prefix):
+ return '/usr/share'
+ elif type == 'bash_comp':
+ if prefix == '/usr':
+ return '/'
+ if sys.prefix.startswith(osx_system_prefix):
+ return '/'
+ elif type == 'zsh_comp':
+ if sys.prefix.startswith(osx_system_prefix):
+ return '/usr'
+ else:
+ raise ValueError('not supported type')
+ return prefix
+
+
+def get_data_files(prefix):
+ data_files = []
+ bash_comp_dest = os.path.join(_resolve_prefix(prefix, 'bash_comp'),
+ 'etc/bash_completion.d')
+ data_files.append((bash_comp_dest, ['completion/wstool-completion.bash']))
+ zsh_comp_dest = os.path.join(_resolve_prefix(prefix, 'zsh_comp'),
+ 'share/zsh/site-functions')
+ data_files.append((zsh_comp_dest, ['completion/_wstool',
+ 'completion/wstool-completion.bash']))
+ return data_files
+
+
+parser = argparse.ArgumentParser()
+parser.add_argument('--prefix', default='',
+ help='prefix to install data files')
+opts, _ = parser.parse_known_args(sys.argv)
+prefix = opts.prefix
+
+data_files = get_data_files(prefix)
+
+# At present setuptools has no methods to resolve dependencies at build time,
+# so we need to check if sphinx is installed.
+# See: https://github.com/pypa/pip/issues/2381
+try:
+ from sphinx.setup_command import BuildDoc
+ HAVE_SPHINX = True
+except:
+ HAVE_SPHINX = False
+
+if HAVE_SPHINX:
+ class WstoolBuildMan(BuildDoc):
+ def initialize_options(self):
+ BuildDoc.initialize_options(self)
+ self.builder = 'man'
+
+ class WstoolBuild(build):
+ """Run additional commands before build command"""
+ def run(self):
+ self.run_command('build_man')
+ build.run(self)
+
+ class WstoolBuildPy(build_py):
+ """Run additional commands before build_py command"""
+ def run(self):
+ self.run_command('build_man')
+ build_py.run(self)
+ cmdclass = dict(
+ build=WstoolBuild,
+ build_py=WstoolBuildPy,
+ build_man=WstoolBuildMan,
+ )
+ man_dest = os.path.join(_resolve_prefix(prefix, 'man'), 'man/man1')
+ data_files.append((man_dest, ['build/sphinx/man/wstool.1']))
+else:
+ cmdclass = {}
+
setup(name='wstool',
version=get_version(),
packages=['wstool'],
package_dir={'': 'src'},
+ data_files=data_files,
+ cmdclass=cmdclass,
# rosinstall dependency to be kept in order not to break ros hydro install instructions
- install_requires=['vcstools>=0.1.34', 'pyyaml'],
+ install_requires=['vcstools>=0.1.37', 'pyyaml'],
scripts=["scripts/wstool"],
author="Tully Foote",
author_email="tfoote at osrfoundation.org",
diff --git a/src/wstool/__version__.py b/src/wstool/__version__.py
index b1fec66..1f299cb 100644
--- a/src/wstool/__version__.py
+++ b/src/wstool/__version__.py
@@ -1 +1 @@
-version = '0.1.6'
+version = '0.1.9'
diff --git a/src/wstool/cli_common.py b/src/wstool/cli_common.py
index a1fe51f..678f1f8 100644
--- a/src/wstool/cli_common.py
+++ b/src/wstool/cli_common.py
@@ -119,6 +119,28 @@ def _uris_match(basepath, uri1, uri2):
return False
+def _get_svn_version_from_uri(uri):
+ """
+ in case of SVN, we can use the final part of
+ standard uri as spec version, if it follows canonical SVN layout
+
+ :param uri: uri to extract version from
+ :returns changed_uri: str, version extracted uri
+ :returns version: str, extracted version
+ :returns: (None, None), for empty uri or when there is no regex match for version info
+ """
+ if uri is None:
+ return None, None
+ match = re.match('(.*/)((tags|branches|trunk)(/.*)*)', uri)
+ if (match is not None and
+ len(match.groups()) > 1 and
+ uri == ''.join(match.groups()[0:2])):
+ changed_uri = match.groups()[0]
+ version = match.groups()[1]
+ return changed_uri, version
+ return None, None
+
+
def _get_status_flags(basepath, elt_dict):
"""
returns a string where each char conveys status information about
@@ -140,6 +162,13 @@ def _get_status_flags(basepath, elt_dict):
elt_dict['actualversion'] is not None and
elt_dict['specversion'] != elt_dict['actualversion'])):
mflag += 'V'
+ if ('remote_revision' in elt_dict and
+ elt_dict['remote_revision'] != '' and
+ elt_dict['remote_revision'] is not None and
+ elt_dict['actualversion'] is not None and
+ 'actualversion' in elt_dict and
+ elt_dict['remote_revision'] != elt_dict['actualversion']):
+ mflag += 'C'
return mflag
@@ -158,6 +187,10 @@ def get_info_table_elements(basepath, entries):
line['curr_version'] = None
if not 'version' in line:
line['version'] = None
+ if not 'remote_revision' in line:
+ line['remote_revision'] = None
+ if not 'curr_version_label' in line:
+ line['curr_version_label'] = None
output_dict = {'scm': line['scm'],
'uri': line['uri'],
'curr_uri': None,
@@ -173,46 +206,31 @@ def get_info_table_elements(basepath, entries):
line['specversion'] = line['specversion'][0:12]
if (line['actualversion'] is not None and len(line['actualversion']) > 12):
line['actualversion'] = line['actualversion'][0:12]
+ if (line['remote_revision'] is not None and len(line['remote_revision']) > 12):
+ line['remote_revision'] = line['remote_revision'][0:12]
if line['scm'] is not None:
if line['scm'] == 'svn':
- # in case of SVN, we can use the final part of
- # standard uri as version
- uri = line['uri']
- version = line['version']
- match = re.match('(.*/)((tags|branches|trunk)(/.*)*)', uri)
- if match is not None and len(match.groups()) > 1 and uri == ''.join(match.groups()[0:2]):
- uri = match.groups()[0]
- if (match.groups()[1] is not None and version is None or version.strip() == ''):
- version = match.groups()[1]
- else:
- version = match.groups()[1]
- line['uri'] = uri
- line['version'] = version
+ (line['uri'],
+ line['version']) = _get_svn_version_from_uri(uri=line['uri'])
if line['curr_uri'] is not None:
- uri = line['curr_uri']
- match = re.match('(.*/)((tags|branches|trunk)(/.*)*)', uri)
- if match is not None and len(match.groups()) > 1 and uri == ''.join(match.groups()[0:2]):
- uri = match.groups()[0]
- if (match.groups()[1] is not None and version is None or version.strip() == ''):
- version = match.groups()[1]
- else:
- version = match.groups()[1]
- line['curr_uri'] = uri
- line['curr_version'] = version
-
- if (line['curr_version'] is not None and
- line['version'] != line['curr_version']):
-
- output_dict['version'] = "%s (%s)" % (line['curr_version'], line['version'])
- else:
- output_dict['version'] = line['version']
+ (line['curr_uri'],
+ line['curr_version_label']) = _get_svn_version_from_uri(
+ uri=line['curr_uri'])
+
+ if line['scm'] in ['git', 'svn', 'hg']:
+ line['curr_version'] = line['curr_version_label']
+
+ if line['curr_version'] is not None:
+ output_dict['version'] = line['curr_version']
+ if output_dict['version'] is not None:
+ if (line['version'] != output_dict['version']):
+ output_dict['version'] += " (%s)" % (line['version'] or '-')
if (line['specversion'] is not None and
line['specversion'] != '' and
line['actualversion'] != line['specversion']):
-
output_dict['matching'] = "%s (%s)" % (line['actualversion'], line['specversion'])
else:
output_dict['matching'] = line['actualversion']
@@ -263,7 +281,7 @@ def get_info_table(basepath, entries, data_only=False, reverse=False, unmanaged=
'uri': "URI (Spec) [http(s)://...]",
'scm': "SCM ",
'localname': "Localname",
- 'version': "Version-Spec",
+ 'version': "Version (Spec)",
'matching': "UID (Spec)",
'status': "S"}
@@ -332,7 +350,8 @@ def get_info_list(basepath, line, data_only=False):
'scm': "SCM:",
'localname': "Localname:",
'path': "Path",
- 'version': "Version-Spec:",
+ 'version': "Spec-Version:",
+ 'curr_version_label': "Current-Version:",
'status': "Status:",
'specversion': "Spec-Revision:",
'actualversion': "Current-Revision:",
@@ -341,8 +360,8 @@ def get_info_list(basepath, line, data_only=False):
# table design
selected_headers = ['localname', 'path', 'status',
'scm', 'uri', 'curr_uri',
- 'version', 'specversion', 'actualversion',
- 'properties']
+ 'version', 'curr_version_label', 'specversion',
+ 'actualversion', 'properties']
line['status'] = _get_status_flags(basepath, line)
diff --git a/src/wstool/common.py b/src/wstool/common.py
index b13a778..9556cad 100644
--- a/src/wstool/common.py
+++ b/src/wstool/common.py
@@ -309,7 +309,7 @@ class DistributedWork():
self.threads = []
self.sequentializers = {}
self.index = 0
- self.num_threads = num_threads
+ self.num_threads = capacity if num_threads <= 0 else max(num_threads, capacity)
self.silent = silent
def add_thread(self, worker):
diff --git a/src/wstool/config_elements.py b/src/wstool/config_elements.py
index 398b689..bede7aa 100644
--- a/src/wstool/config_elements.py
+++ b/src/wstool/config_elements.py
@@ -32,6 +32,7 @@
import os
+import sys
import shutil
import datetime
@@ -139,6 +140,7 @@ class ConfigElement(object):
def get_status(self, basepath=None, untracked=False):
raise NotImplementedError("ConfigElement get_status unimplemented")
+
def backup(self, backup_path):
if not backup_path:
raise MultiProjectException(
@@ -396,7 +398,7 @@ class VCSConfigElement(ConfigElement):
version=version,
tags=self.get_properties())
- def get_versioned_path_spec(self):
+ def get_versioned_path_spec(self, fetch=False):
"yaml looking up current version"
version = self.version
if version == '':
@@ -405,7 +407,12 @@ class VCSConfigElement(ConfigElement):
if version is not None:
# revision is the UID of the version spec, can be them same
revision = self._get_vcsc().get_version(self.version)
+ if revision is None:
+ sys.stderr.write("Warning: version '%s' not found for '%s'\n"
+ % (self.version, self.local_name))
currevision = self._get_vcsc().get_version()
+ remote_revision = self._get_vcsc().get_remote_version(fetch=fetch)
+ curr_version = self._get_vcsc().get_current_version_label()
uri = self.uri
curr_uri = self._get_vcsc().get_url()
# uri might be a shorthand notation equivalent to curr_uri
@@ -416,8 +423,10 @@ class VCSConfigElement(ConfigElement):
scmtype=self.get_vcs_type_name(),
uri=self.uri,
version=version,
+ curr_version=curr_version,
revision=revision,
currevision=currevision,
+ remote_revision=remote_revision,
curr_uri=curr_uri,
tags=self.get_properties())
diff --git a/src/wstool/config_yaml.py b/src/wstool/config_yaml.py
index 4d27e0b..0c26c50 100644
--- a/src/wstool/config_yaml.py
+++ b/src/wstool/config_yaml.py
@@ -183,9 +183,11 @@ class PathSpec:
scmtype=None,
uri=None,
version=None,
+ curr_version=None,
tags=None,
revision=None,
currevision=None,
+ remote_revision=None,
path=None,
curr_uri=None):
"""
@@ -194,6 +196,7 @@ class PathSpec:
:param scmtype: one of __ALLTYPES__
:param uri: uri from config file
:param version: version label from config file (branchname, tagname, sha-id)
+ :param cur_version: version information label(s) from VCS (branchname, remote, tracking branch)
:param tags: arbirtrary meta-information (used for ROS package indexing)
:param revision: unique id of label stored in version
:param currrevision: unique id of actual version in file system
@@ -205,10 +208,12 @@ class PathSpec:
self._uri = uri
self._curr_uri = curr_uri
self._version = version
+ self._curr_version = curr_version
self._scmtype = scmtype
self._tags = tags or []
self._revision = revision
self._currevision = currevision
+ self._remote_revision = remote_revision
def __str__(self):
return str(self.get_legacy_yaml())
@@ -231,8 +236,10 @@ class PathSpec:
self._scmtype = None
self._uri = None
self._version = None
+ self._curr_version = None
self._revision = None
self._currevision = None
+ self._remote_revision = None
def get_legacy_type(self):
"""return one of __ALLTYPES__"""
@@ -286,12 +293,18 @@ class PathSpec:
def get_version(self):
return self._version
+ def get_curr_version(self):
+ return self._curr_version
+
def get_revision(self):
return self._revision
def get_current_revision(self):
return self._currevision
+ def get_remote_revision(self):
+ return self._remote_revision
+
def get_uri(self):
return self._uri
@@ -310,7 +323,7 @@ def get_path_spec_from_yaml(yaml_dict):
tags = []
if type(yaml_dict) != dict:
raise MultiProjectException(
- "Yaml for each element must be in YAML dict form")
+ "Yaml for each element must be in YAML dict form: %s " % yaml_dict)
# old syntax:
# - hg: {local-name: common_rosdeps,
# version: common_rosdeps-1.0.2,
diff --git a/src/wstool/multiproject_cli.py b/src/wstool/multiproject_cli.py
index 579c8d9..e7e357d 100644
--- a/src/wstool/multiproject_cli.py
+++ b/src/wstool/multiproject_cli.py
@@ -61,13 +61,14 @@ __MULTIPRO_CMD_DICT__ = {
"remove": "remove an entry from your workspace config, without deleting files",
"snapshot": "write a file specifying repositories to have the version they currently have",
"diff": "print a diff over some SCM controlled entries",
+ "foreach": "run shell command in given entries",
"status": "print the change status of files in some SCM controlled entries"}
# usage help ordering and sections
__MULTIPRO_CMD_HELP_LIST__ = ['help', 'init',
None, 'set', 'merge', 'remove',
None, 'update',
- None, 'info', 'status', 'diff']
+ None, 'info', 'status', 'diff', 'foreach']
# command aliases
__MULTIPRO_CMD_ALIASES__ = {'update': 'up',
@@ -217,8 +218,9 @@ def prompt_merge(target_path,
additional_uris=[],
config_filename=config_filename)
config_actions = multiproject_cmd.add_uris(
- newconfig,
+ config=newconfig,
additional_uris=additional_uris,
+ config_filename=None,
merge_strategy=merge_strategy,
allow_other_element=allow_other_element)
for path_spec in additional_specs:
@@ -450,7 +452,7 @@ $ %(prog)s init ~/fuerte /opt/ros/fuerte
config = multiproject_cmd.get_config(
basepath=target_path,
additional_uris=config_uris,
- # catkin workspaces have no resaonable wstool chaining semantics
+ # catkin workspaces have no reasonable chaining semantics
# config_filename=self.config_filename
)
if config_uris and len(config.get_config_elements()) == 0:
@@ -620,6 +622,106 @@ $ roslocate info robot_model | %(prog)s merge -
return False
+ def cmd_foreach(self, target_path, argv, config=None):
+ """Run shell commands in each repository."""
+ parser = OptionParser(
+ usage=('usage: %s foreach [[localname]* | [VCSFILTER]*]'
+ ' [command] [OPTIONS]' % self.progname),
+ description=__MULTIPRO_CMD_DICT__['foreach'],
+ epilog='See: http://www.ros.org/wiki/rosinstall for details')
+ parser.add_option('--shell', default=False,
+ help='use the shell as the program to execute',
+ action='store_true')
+ parser.add_option('--no-stdout', dest='show_stdout',
+ default=True,
+ help='do not show stdout',
+ action='store_false')
+ parser.add_option('--no-stderr', dest='show_stderr',
+ default=True,
+ help='do not show stderr',
+ action='store_false')
+ parser.add_option("--git", dest="git", default=False,
+ help="run command in git entries",
+ action="store_true")
+ parser.add_option("--svn", dest="svn", default=False,
+ help="run command in svn entries",
+ action="store_true")
+ parser.add_option("--hg", dest="hg", default=False,
+ help="run command in hg entries",
+ action="store_true")
+ parser.add_option("--bzr", dest="bzr", default=False,
+ help="run command in bzr entries",
+ action="store_true")
+ # -t option required here for help but used one layer above
+ # see cli_common
+ parser.add_option("-t", "--target-workspace", dest="workspace",
+ default=None,
+ help="which workspace to use",
+ action="store")
+ (options, args) = parser.parse_args(argv)
+
+ if args:
+ localnames, command = args[:-1], args[-1]
+ localnames = localnames if localnames else None
+ else:
+ print("Error: Too few arguments.")
+ print(parser.usage)
+ return -1
+
+ scm_types = []
+ if options.git:
+ scm_types.append('git')
+ if options.svn:
+ scm_types.append('svn')
+ if options.hg:
+ scm_types.append('hg')
+ if options.bzr:
+ scm_types.append('bzr')
+ if not scm_types:
+ scm_types = None
+
+ if localnames and scm_types:
+ sys.stderr.write("Error: Either localnames or scm-filters"
+ " [--(git|svn|hg|bzr)] should be specified.\n")
+ return -1
+
+ if config is None:
+ config = multiproject_cmd.get_config(
+ target_path,
+ additional_uris=[],
+ config_filename=self.config_filename)
+ elif config.get_base_path() != target_path:
+ raise MultiProjectException('Config path does not match %s %s' %
+ (config.get_base_path(), target_path))
+
+ # run shell command
+ outputs = multiproject_cmd.cmd_foreach(config,
+ command=command,
+ localnames=localnames,
+ scm_types=scm_types,
+ shell=options.shell)
+
+ def add_localname_prefix(localname, lines):
+ return ['[%s] %s' % (localname, line) for line in lines]
+
+ for output in outputs:
+ localname = output['entry'].get_local_name()
+ if options.show_stdout:
+ if output['stdout'] is None:
+ continue
+ lines = output['stdout'].strip().split('\n')
+ lines = add_localname_prefix(localname, lines)
+ sys.stdout.write('\n'.join(lines))
+ sys.stdout.write('\n')
+ if options.show_stderr:
+ if output['stderr'] is None:
+ continue
+ lines = output['stderr'].strip().split('\n')
+ lines = add_localname_prefix(localname, lines)
+ sys.stderr.write('\n'.join(lines))
+ sys.stderr.write('\n')
+ return 0
+
def cmd_status(self, target_path, argv, config=None):
parser = OptionParser(usage="usage: %s status [localname]* " % self.progname,
description=__MULTIPRO_CMD_DICT__["status"] +
@@ -711,6 +813,9 @@ $ %(progname)s set robot_model --version-new robot_model-1.7.1
parser.add_option("-y", "--confirm", dest="confirm", default='',
help="Do not ask for confirmation",
action="store_true")
+ parser.add_option("-u", "--update", dest="do_update", default=False,
+ help="update repository after set",
+ action="store_true")
# -t option required here for help but used one layer above, see cli_common
parser.add_option(
"-t", "--target-workspace", dest="workspace", default=None,
@@ -799,14 +904,15 @@ $ %(progname)s set robot_model --version-new robot_model-1.7.1
scmtype=scmtype)
else:
# modify
+ localname = element.get_local_name()
old_spec = element.get_path_spec()
if options.detach:
- spec = PathSpec(local_name=element.get_local_name())
+ spec = PathSpec(local_name=localname)
else:
# '' evals to False, we do not want that
if version is None:
version = old_spec.get_version()
- spec = PathSpec(local_name=element.get_local_name(),
+ spec = PathSpec(local_name=localname,
uri=normalize_uri(uri or old_spec.get_uri(),
config.get_base_path()),
version=version,
@@ -838,7 +944,13 @@ $ %(progname)s set robot_model --version-new robot_model-1.7.1
os.path.join(newconfig.get_base_path(), self.config_filename),
"%s.bak" % os.path.join(newconfig.get_base_path(), self.config_filename))
self.config_generator(newconfig, self.config_filename)
- if (spec.get_scmtype() is not None):
+ if options.do_update:
+ install_success = multiproject_cmd.cmd_install_or_update(
+ newconfig, localnames=[localname])
+ if not install_success:
+ print("Warning: installation encountered errors.")
+ print("\nupdate complete.")
+ elif (spec.get_scmtype() is not None):
print("Config changed, remember to run '%s update %s' to update the folder from %s" %
(self.progname, spec.get_local_name(), spec.get_scmtype()))
else:
@@ -982,6 +1094,7 @@ The Status (S) column shows
x for missing
L for uncommited (local) changes
V for difference in version and/or remote URI
+ C for difference in local and remote versions
The 'Version-Spec' column shows what tag, branch or revision was given
in the .rosinstall file. The 'UID' column shows the unique ID of the
@@ -1005,6 +1118,10 @@ $ %(prog)s info --only=path,cur_uri,cur_revision robot_model geometry
""" % {'prog': self.progname, 'opts': ONLY_OPTION_VALID_ATTRS},
epilog="See: http://www.ros.org/wiki/rosinstall for details\n")
parser.add_option(
+ "--root", dest="show_ws_root", default=False,
+ help="Show workspace root path",
+ action="store_true")
+ parser.add_option(
"--data-only", dest="data_only", default=False,
help="Does not provide explanations",
action="store_true")
@@ -1017,6 +1134,10 @@ $ %(prog)s info --only=path,cur_uri,cur_revision robot_model geometry
help="Shows only version of single entry. Intended for scripting.",
action="store_true")
parser.add_option(
+ "--fetch", dest="fetch", default=False,
+ help="When used, retrieves version information from remote (takes longer).",
+ action="store_true")
+ parser.add_option(
"-u", "--untracked", dest="untracked",
default=False,
help="Also show untracked files as modifications",
@@ -1041,6 +1162,10 @@ $ %(prog)s info --only=path,cur_uri,cur_revision robot_model geometry
raise MultiProjectException("Config path does not match %s %s " %
(config.get_base_path(), target_path))
+ if options.show_ws_root:
+ print(config.get_base_path())
+ return 0
+
if args == []:
args = None
@@ -1062,7 +1187,8 @@ $ %(prog)s info --only=path,cur_uri,cur_revision robot_model geometry
# this call takes long, as it invokes scms.
outputs = multiproject_cmd.cmd_info(config,
localnames=args,
- untracked=options.untracked)
+ untracked=options.untracked,
+ fetch=options.fetch)
if args and len(args) == 1:
# if only one element selected, print just one line
print(get_info_list(config.get_base_path(),
diff --git a/src/wstool/multiproject_cmd.py b/src/wstool/multiproject_cmd.py
index ce6a0e1..a5e5585 100644
--- a/src/wstool/multiproject_cmd.py
+++ b/src/wstool/multiproject_cmd.py
@@ -45,6 +45,7 @@ A change to expect is abstraction of user interaction.
import sys
import os
+import shlex
from wstool.common import MultiProjectException, DistributedWork, \
select_elements, normabspath
from wstool.config import Config, realpath_relation
@@ -54,6 +55,7 @@ from wstool.config_yaml import aggregate_from_uris, generate_config_yaml, \
import vcstools
import vcstools.__version__
+from vcstools.common import run_shell_command
from vcstools.vcs_abstraction import get_vcs_client
from vcstools.git import GitClient
from vcstools.hg import HgClient
@@ -104,13 +106,19 @@ def get_config(basepath,
config_filename=config_filename,
merge_strategy=merge_strategy)
- add_uris(config, additional_uris, merge_strategy)
+ add_uris(config=config,
+ additional_uris=additional_uris,
+ config_filename=config.get_config_filename(),
+ merge_strategy=merge_strategy)
return config
def add_uris(config,
additional_uris,
+ # config_filename is not redundant with config.get_config_filename()
+ # because in some cases a different config_filename is required
+ config_filename=None,
merge_strategy="KillAppend",
allow_other_element=True):
"""
@@ -133,7 +141,7 @@ def add_uris(config,
if not additional_uris:
return {}
- if config.get_config_filename() is None:
+ if config_filename is None:
added_uris = additional_uris
else:
added_uris = []
@@ -143,11 +151,11 @@ def add_uris(config,
# check whether we try to merge with other workspace
comp_uri = None
if (os.path.isfile(uri)
- and os.path.basename(uri) == config.get_config_filename()):
+ and os.path.basename(uri) == config_filename):
# add from other workspace by file
comp_uri = os.path.dirname(uri)
if (os.path.isdir(uri)
- and os.path.isfile(os.path.join(uri, config.get_config_filename()))):
+ and os.path.isfile(os.path.join(uri, config_filename))):
# add from other workspace by dir
comp_uri = uri
if (comp_uri is not None and
@@ -160,7 +168,7 @@ def add_uris(config,
actions = {}
if len(added_uris) > 0:
path_specs = aggregate_from_uris(added_uris,
- config.get_config_filename(),
+ config_filename,
allow_other_element)
for path_spec in path_specs:
action = config.add_path_spec(path_spec, merge_strategy)
@@ -232,7 +240,7 @@ def cmd_status(config, localnames=None, untracked=False):
path = config.get_base_path()
# call SCM info in separate threads
elements = config.get_config_elements()
- work = DistributedWork(len(elements))
+ work = DistributedWork(capacity=len(elements), num_threads=-1)
elements = select_elements(config, localnames)
for element in elements:
if element.is_vcs_element():
@@ -259,7 +267,7 @@ def cmd_diff(config, localnames=None):
path = config.get_base_path()
elements = config.get_config_elements()
- work = DistributedWork(len(elements))
+ work = DistributedWork(capacity=len(elements), num_threads=-1)
elements = select_elements(config, localnames)
for element in elements:
if element.is_vcs_element():
@@ -268,6 +276,36 @@ def cmd_diff(config, localnames=None):
return outputs
+def cmd_foreach(config, command, localnames=None, scm_types=None, shell=False):
+ """Run command in all SCM entries in config, relative to path"""
+
+ class ForeachRetriever(object):
+ def __init__(self, element, command, shell):
+ self.element = element
+ self.command = command
+ self.shell = shell
+
+ def do_work(self):
+ command = self.command
+ if not self.shell:
+ command = shlex.split(command)
+ _, stdout, stderr = run_shell_command(command,
+ cwd=self.element.path,
+ show_stdout=False,
+ shell=self.shell)
+ return {'stdout': stdout, 'stderr': stderr}
+
+ elements = select_elements(config, localnames)
+ work = DistributedWork(capacity=len(elements))
+ for element in elements:
+ if ((scm_types is not None) and
+ (element.get_vcs_type_name() not in scm_types)):
+ continue
+ work.add_thread(ForeachRetriever(element, command, shell))
+ outputs = work.run()
+ return outputs
+
+
def cmd_install_or_update(
config,
backup_path=None,
@@ -339,7 +377,9 @@ def cmd_install_or_update(
verbose=self.report.verbose)
return {}
- work = DistributedWork(len(preparation_reports), num_threads, silent=False)
+ work = DistributedWork(capacity=len(preparation_reports),
+ num_threads=num_threads,
+ silent=False)
for report in preparation_reports:
report.verbose = verbose
report.timeout = timeout
@@ -384,7 +424,7 @@ def cmd_snapshot(config, localnames=None):
return source_aggregate
-def cmd_info(config, localnames=None, untracked=False):
+def cmd_info(config, localnames=None, untracked=False, fetch=False):
"""This function compares what should be (config_file) with what is
(directories) and returns a list of dictionary giving each local
path and all the state information about it available.
@@ -395,9 +435,10 @@ def cmd_info(config, localnames=None, untracked=False):
Auxilliary class to perform IO-bound operations in individual threads
"""
- def __init__(self, element, path, untracked):
+ def __init__(self, element, path, untracked, fetch):
self.element = element
self.path = path
+ self.fetch = fetch
self.untracked = untracked
def do_work(self):
@@ -407,8 +448,11 @@ def cmd_info(config, localnames=None, untracked=False):
curr_uri = None
exists = False
version = "" # what is given in config file
+ curr_version_label = "" # e.g. branchname
+ remote_revision = "" # UID on remote
+ display_version = ''
modified = ""
- actualversion = "" # revision number of version
+ currevision = "" # revision number of version
specversion = "" # actual revision number
localname = self.element.get_local_name()
path = self.element.get_path() or localname
@@ -423,8 +467,15 @@ def cmd_info(config, localnames=None, untracked=False):
path_spec = self.element.get_path_spec()
version = path_spec.get_version()
else:
- path_spec = self.element.get_versioned_path_spec()
+ path_spec = self.element.get_versioned_path_spec(fetch=fetch)
version = path_spec.get_version()
+ remote_revision = path_spec.get_remote_revision()
+ curr_version_label = path_spec.get_curr_version()
+ if (curr_version_label is not None and
+ version != curr_version_label):
+ display_version = curr_version_label
+ else:
+ display_version = version
curr_uri = path_spec.get_curr_uri()
status = self.element.get_status(self.path, self.untracked)
if (status is not None and
@@ -434,9 +485,8 @@ def cmd_info(config, localnames=None, untracked=False):
if (version is not None and
version.strip() != '' and
(specversion is None or specversion.strip() == '')):
-
specversion = '"%s"' % version
- actualversion = path_spec.get_current_revision()
+ currevision = path_spec.get_current_revision()
scm = path_spec.get_scmtype()
uri = path_spec.get_uri()
return {'scm': scm,
@@ -446,8 +496,10 @@ def cmd_info(config, localnames=None, untracked=False):
'uri': uri,
'curr_uri': curr_uri,
'version': version,
+ 'remote_revision': remote_revision,
+ 'curr_version_label': curr_version_label,
'specversion': specversion,
- 'actualversion': actualversion,
+ 'actualversion': currevision,
'modified': modified,
'properties': self.element.get_properties()}
@@ -455,10 +507,10 @@ def cmd_info(config, localnames=None, untracked=False):
# call SCM info in separate threads
elements = config.get_config_elements()
elements = select_elements(config, localnames)
- work = DistributedWork(len(elements))
+ work = DistributedWork(capacity=len(elements), num_threads=-1)
for element in elements:
if element.get_properties() is None or not 'setup-file' in element.get_properties():
- work.add_thread(InfoRetriever(element, path, untracked))
+ work.add_thread(InfoRetriever(element, path, untracked, fetch))
outputs = work.run()
return outputs
@@ -508,7 +560,7 @@ def cmd_find_unmanaged_repos(config):
unmanaged_paths.append((os.path.relpath(root, path), key))
# don't walk any other directories in this root
del dirs[:]
- work = DistributedWork(len(unmanaged_paths))
+ work = DistributedWork(capacity=len(unmanaged_paths), num_threads=-1)
for localname, scm_type in sorted(unmanaged_paths, key=lambda up: up[0], reverse=True):
work.add_thread(UnmanagedInfoRetriever(path, localname, scm_type))
outputs = work.run()
diff --git a/src/wstool/wstool_cli.py b/src/wstool/wstool_cli.py
index 835fc2c..689ae6d 100644
--- a/src/wstool/wstool_cli.py
+++ b/src/wstool/wstool_cli.py
@@ -141,6 +141,7 @@ def wstool_main(argv=None, usage=None):
'set': cli.cmd_set,
'merge': cli.cmd_merge,
'diff': cli.cmd_diff,
+ 'foreach': cli.cmd_foreach,
'status': cli.cmd_status,
'update': cli.cmd_update}
for label in list(ws_commands.keys()):
diff --git a/stdeb.cfg b/stdeb.cfg
index 46536e4..c1c10ad 100644
--- a/stdeb.cfg
+++ b/stdeb.cfg
@@ -1,6 +1,6 @@
[DEFAULT]
-Depends: subversion, mercurial, git-core, bzr, python-yaml, python-vcstools (>= 0.1.34)
-Depends3: subversion, mercurial, git-core, bzr, python3-yaml, python3-vcstools (>= 0.1.34)
+Depends: subversion, mercurial, git-core, bzr, python-yaml, python-vcstools (>= 0.1.37)
+Depends3: subversion, mercurial, git-core, bzr, python3-yaml, python3-vcstools (>= 0.1.37)
Conflicts: python3-wstool
Conflicts3: python-wstool
Suite: oneiric precise quantal raring saucy trusty utopic vivid wheezy jessie
diff --git a/test/local/mock_client.py b/test/local/mock_client.py
index 72c5c1d..3c66060 100644
--- a/test/local/mock_client.py
+++ b/test/local/mock_client.py
@@ -47,7 +47,8 @@ class MockVcsClient():
vcs_presence=False,
url="mockurl",
actualversion=None,
- specversion=None):
+ specversion=None,
+ remoteversion=None):
self.scmtype = scmtype
self.path_exists_flag = path_exists
self.checkout_success = checkout_success
@@ -58,6 +59,7 @@ class MockVcsClient():
self.updated = False
self.actualversion = actualversion
self.specversion = specversion
+ self.remoteversion = remoteversion
def get_vcs_type_name(self):
return self.scmtype
@@ -71,6 +73,12 @@ class MockVcsClient():
else:
return self.specversion
+ def get_remote_version(self, fetch=False):
+ return self.remoteversion
+
+ def get_current_version_label(self):
+ return self.scmtype + "mockcurrentversionlabel"
+
def get_status(self, basepath=None, untracked=False):
return self.scmtype + " mockstatus%s,%s" % (basepath, untracked)
diff --git a/test/local/test_cli.py b/test/local/test_cli.py
index bec834c..13df6de 100644
--- a/test/local/test_cli.py
+++ b/test/local/test_cli.py
@@ -51,6 +51,7 @@ from wstool.config_yaml import PathSpec
from test.scm_test_base import AbstractFakeRosBasedTest, _add_to_file, \
_nth_line_split, _create_yaml_file, _create_config_elt_dict
+from test.io_wrapper import StringIO
from . import mock_client
@@ -86,7 +87,7 @@ class GetWorkspaceTest(unittest.TestCase):
def setUpClass(self):
self.environback = copy.copy(os.environ)
self.new_environ = os.environ
- self.test_root_path = tempfile.mkdtemp()
+ self.test_root_path = os.path.realpath(tempfile.mkdtemp())
self.install_path = os.path.join(self.test_root_path, "install")
os.makedirs(self.install_path)
self.install_path2 = os.path.join(self.test_root_path, "install2")
@@ -263,7 +264,7 @@ class MockVcsConfigElement(wstool.config_elements.VCSConfigElement):
class InstallTest(unittest.TestCase):
def test_mock_install(self):
- test_root = tempfile.mkdtemp()
+ test_root = os.path.realpath(tempfile.mkdtemp())
try:
git1 = PathSpec('foo', 'git', 'git/uri', 'git.version')
svn1 = PathSpec('foos', 'svn', 'svn/uri', '12345')
@@ -286,7 +287,7 @@ class InstallTest(unittest.TestCase):
shutil.rmtree(test_root)
def test_mock_install_fail(self):
- test_root = tempfile.mkdtemp()
+ test_root = os.path.realpath(tempfile.mkdtemp())
try:
# robust
git1 = PathSpec('foo', 'git', 'git/uri', 'git.version')
@@ -395,7 +396,7 @@ class GetStatusDiffInfoCmdTest(unittest.TestCase):
self.assertEqual(result[3]['scm'], 'bzr')
def test_unmanaged(self):
- root_path = tempfile.mkdtemp()
+ root_path = os.path.realpath(tempfile.mkdtemp())
ws_path = os.path.join(root_path, "ws")
os.makedirs(ws_path)
@@ -435,7 +436,7 @@ class GetStatusDiffInfoCmdTest(unittest.TestCase):
self.assertEqual(len(result), 3)
def test_info_real_path(self):
- root_path = tempfile.mkdtemp()
+ root_path = os.path.realpath(tempfile.mkdtemp())
el_path = os.path.join(root_path, "ros")
os.makedirs(el_path)
try:
@@ -475,7 +476,7 @@ class GetStatusDiffInfoCmdTest(unittest.TestCase):
shutil.rmtree(root_path)
def test_get_status(self):
- self.test_root_path = tempfile.mkdtemp()
+ self.test_root_path = os.path.realpath(tempfile.mkdtemp())
try:
basepath = '/foo/path'
entry = {}
@@ -558,7 +559,7 @@ class GetStatusDiffInfoCmdTest(unittest.TestCase):
'localname': 'localname',
'specversion': None,
'actualversion': None}]
- self.assertEqual(["localname", "svn", "tags/tagname", "some.svn.tags.server/some/"], _nth_line_split(-1, wstool.cli_common.get_info_table(basepath, entries)))
+ self.assertEqual(["localname", "svn", "version", "(tags/tagname)", "some.svn.tags.server/some/"], _nth_line_split(-1, wstool.cli_common.get_info_table(basepath, entries)))
entries = [{'scm': 'svn',
'uri': 'https://some.svn.tags.server/some/branches/branchname',
'curr_uri': None,
@@ -566,7 +567,7 @@ class GetStatusDiffInfoCmdTest(unittest.TestCase):
'localname': 'localname',
'specversion': None,
'actualversion': None}]
- self.assertEqual(["localname", "svn", "branches/branchname", "some.svn.tags.server/some/"], _nth_line_split(-1, wstool.cli_common.get_info_table(basepath, entries)))
+ self.assertEqual(["localname", "svn", "version", "(branches/branchname)", "some.svn.tags.server/some/"], _nth_line_split(-1, wstool.cli_common.get_info_table(basepath, entries)))
entries = [{'scm': 'svn',
'uri': 'https://some.svn.tags.server/some/trunk',
'curr_uri': None,
@@ -574,7 +575,7 @@ class GetStatusDiffInfoCmdTest(unittest.TestCase):
'localname': 'localname',
'specversion': None,
'actualversion': None}]
- self.assertEqual(["localname", "svn", "trunk", "some.svn.tags.server/some/"], _nth_line_split(-1, wstool.cli_common.get_info_table(basepath, entries)))
+ self.assertEqual(["localname", "svn", "version", "(trunk)", "some.svn.tags.server/some/"], _nth_line_split(-1, wstool.cli_common.get_info_table(basepath, entries)))
entries = [{'scm': 'svn',
'uri': 'https://some.svn.tags.server/some/branches/branchname',
'curr_uri': 'https://some.svn.tags.server/some/tags/tagname',
@@ -648,6 +649,12 @@ class MultiprojectCLITest(AbstractFakeRosBasedTest):
self.assertTrue(os.path.exists(os.path.join(self.local_path, 'gitrepo')))
self.assertTrue(os.path.exists(os.path.join(self.local_path, 'hgrepo')))
+ def test_cmd_info(self):
+ self.local_path = os.path.join(self.test_root_path, "ws_test_cmd_info")
+ cli = MultiprojectCLI(progname='multi_cli',
+ config_filename='.rosinstall')
+ self.assertEqual(0, cli.cmd_info(self.local_path, ['--root']))
+
def test_cmd_set(self):
self.local_path = os.path.join(self.test_root_path, "ws31b")
cli = MultiprojectCLI(progname='multi_cli', config_filename='.rosinstall')
@@ -657,6 +664,10 @@ class MultiprojectCLITest(AbstractFakeRosBasedTest):
"--hg",
'http://some_uri',
'-y']))
+ cli.cmd_set(self.local_path,
+ [os.path.join(self.local_path, 'hgrepo'), self.hg_path,
+ '--hg', '--update', '-y'])
+ self.assertTrue(os.path.exists(os.path.join(self.local_path, 'hgrepo')))
self.assertRaises(SystemExit, cli.cmd_set, self.local_path,
[os.path.join(self.local_path, 'hgrepo'),
"--detached",
@@ -669,6 +680,24 @@ class MultiprojectCLITest(AbstractFakeRosBasedTest):
"--detached",
'-y']))
+ def test_cmd_foreach(self):
+ self.local_path = os.path.join(self.test_root_path, 'foreach')
+ cli = MultiprojectCLI(progname='multi_cli', config_filename='.rosinstall')
+ cli.cmd_init([self.local_path, self.simple_rosinstall])
+ # specified localname
+ sys.stdout = f = StringIO()
+ cli.cmd_foreach(self.local_path, argv=['gitrepo', 'pwd'])
+ sys.stdout = sys.__stdout__
+ repo_path = lambda localname: os.path.join(self.local_path, localname)
+ self.assertEqual('[gitrepo] %s' % repo_path('gitrepo'),
+ f.getvalue().strip())
+ # --git option
+ sys.stdout = f = StringIO()
+ cli.cmd_foreach(self.local_path, argv=['--git', 'pwd'])
+ sys.stdout = sys.__stdout__
+ expected_output = '[ros] %s\n[gitrepo] %s' % (repo_path('ros'),
+ repo_path('gitrepo'))
+ self.assertEqual(expected_output, f.getvalue().strip())
def test_cmd_remove(self):
# wstool to create dir
@@ -763,7 +792,7 @@ class MultiprojectCLITest(AbstractFakeRosBasedTest):
self.assertTrue(os.path.exists(os.path.join(self.local_path, 'hgrepo')))
def test_export(self):
- root_path = tempfile.mkdtemp()
+ root_path = os.path.realpath(tempfile.mkdtemp())
el_path = os.path.join(root_path, "ros")
os.makedirs(el_path)
try:
diff --git a/test/local/test_diff_functions_git.py b/test/local/test_diff_functions_git.py
index b133421..6403b2a 100644
--- a/test/local/test_diff_functions_git.py
+++ b/test/local/test_diff_functions_git.py
@@ -186,25 +186,26 @@ class WstoolInfoGitTest(AbstractSCMTest):
def setUp(self):
AbstractSCMTest.setUp(self)
- remote_path = os.path.join(self.test_root_path, "remote")
- os.makedirs(remote_path)
+ self.remote_path = os.path.join(self.test_root_path, "remote")
+ os.makedirs(self.remote_path)
# create a "remote" repo
- subprocess.check_call(["git", "init"], cwd=remote_path)
- subprocess.check_call(["touch", "test.txt"], cwd=remote_path)
- subprocess.check_call(["git", "add", "*"], cwd=remote_path)
- subprocess.check_call(["git", "commit", "-m", "modified"], cwd=remote_path)
- po = subprocess.Popen(["git", "log", "-n", "1", "--pretty=format:\"%H\""], cwd=remote_path, stdout=subprocess.PIPE)
+ subprocess.check_call(["git", "init"], cwd=self.remote_path)
+ subprocess.check_call(["touch", "test.txt"], cwd=self.remote_path)
+ subprocess.check_call(["git", "add", "*"], cwd=self.remote_path)
+ subprocess.check_call(["git", "commit", "-m", "modified"], cwd=self.remote_path)
+ po = subprocess.Popen(["git", "log", "-n", "1", "--pretty=format:\"%H\""], cwd=self.remote_path, stdout=subprocess.PIPE)
self.version_init = po.stdout.read().decode('UTF-8').rstrip('"').lstrip('"')[0:12]
- subprocess.check_call(["git", "tag", "footag"], cwd=remote_path)
- subprocess.check_call(["touch", "test2.txt"], cwd=remote_path)
- subprocess.check_call(["git", "add", "*"], cwd=remote_path)
- subprocess.check_call(["git", "commit", "-m", "modified"], cwd=remote_path)
- po = subprocess.Popen(["git", "log", "-n", "1", "--pretty=format:\"%H\""], cwd=remote_path, stdout=subprocess.PIPE)
+ subprocess.check_call(["git", "tag", "footag"], cwd=self.remote_path)
+ subprocess.check_call(["touch", "test2.txt"], cwd=self.remote_path)
+ subprocess.check_call(["git", "add", "*"], cwd=self.remote_path)
+ subprocess.check_call(["git", "commit", "-m", "modified"], cwd=self.remote_path)
+ po = subprocess.Popen(["git", "log", "-n", "1", "--pretty=format:\"%H\""], cwd=self.remote_path, stdout=subprocess.PIPE)
self.version_end = po.stdout.read().decode('UTF-8').rstrip('"').lstrip('"')[0:12]
# wstool the remote repo and fake ros
_add_to_file(os.path.join(self.local_path, ".rosinstall"), "- other: {local-name: ../ros}\n- git: {local-name: clone, uri: ../remote}")
+ self.clone_path = os.path.join(self.local_path, "clone")
cmd = ["wstool", "update"]
os.chdir(self.local_path)
@@ -214,30 +215,81 @@ class WstoolInfoGitTest(AbstractSCMTest):
sys.stdout = sys.__stdout__
def test_wstool_detailed_localpath_info(self):
- cmd = ["wstool", "info", "-t", "ws"]
+ cmd = ["wstool", "info", "-t", "ws", "--managed-only"]
os.chdir(self.test_root_path)
sys.stdout = output = StringIO()
wstool_main(cmd)
output = output.getvalue()
tokens = _nth_line_split(-2, output)
- self.assertEqual(['clone', 'git', self.version_end, os.path.join(self.test_root_path, 'remote')], tokens, output)
+ self.assertEqual(['clone', 'git', 'master', '(-)', self.version_end, self.remote_path], tokens)
+
+ # test when remote version is different
+ subprocess.check_call(["git", "reset", "--hard", "HEAD~1"], cwd=self.clone_path)
+ sys.stdout = output = StringIO()
+ wstool_main(cmd)
+ output = output.getvalue()
+ tokens = _nth_line_split(-2, output)
+ self.assertEqual(['clone', 'C', 'git', 'master', '(-)', self.version_init, self.remote_path], tokens)
+ # return branch back to original revision
+ subprocess.check_call(["git", "reset", "--hard", self.version_end], cwd=self.clone_path)
- clone_path = os.path.join(self.local_path, "clone")
# make local modifications check
- subprocess.check_call(["rm", "test2.txt"], cwd=clone_path)
+ subprocess.check_call(["rm", "test2.txt"], cwd=self.clone_path)
sys.stdout = output = StringIO()
wstool_main(cmd)
output = output.getvalue()
tokens = _nth_line_split(-2, output)
- self.assertEqual(['clone', 'M', 'git', self.version_end, os.path.join(self.test_root_path, 'remote')], tokens)
+ self.assertEqual(['clone', 'M', 'git', 'master', '(-)', self.version_end, self.remote_path], tokens)
subprocess.check_call(["rm", ".rosinstall"], cwd=self.local_path)
_add_to_file(os.path.join(self.local_path, ".rosinstall"), "- other: {local-name: ../ros}\n- git: {local-name: clone, uri: ../remote, version: \"footag\"}")
+ # test when version is different
+ sys.stdout = output = StringIO()
+ wstool_main(cmd)
+ output = output.getvalue()
+ tokens = _nth_line_split(-2, output)
+ self.assertEqual(['clone', 'MV', 'git', 'master', '(footag)', self.version_end, "(%s)" % self.version_init, self.remote_path], tokens)
+ # test when tracking branch is different from current branch
+ subprocess.check_call(["git", "checkout", "-b", "test_branch"], cwd=self.clone_path)
+ subprocess.check_call(["git", "config", "--replace-all", "branch.test_branch.remote", "origin"], cwd=self.clone_path)
+ subprocess.check_call(["git", "config", "--replace-all", "branch.test_branch.merge", "master"], cwd=self.clone_path)
+ sys.stdout = output = StringIO()
+ wstool_main(cmd)
+ output = output.getvalue()
+ tokens = _nth_line_split(-2, output)
+ self.assertEqual(['clone', 'MV', 'git', 'test_branch', '<', 'master', '(footag)', self.version_end, "(%s)" % self.version_init, self.remote_path], tokens)
+
+ # test when remote is different from origin by rename
+ subprocess.check_call(["git", "remote", "rename", "origin", "remote2"], cwd=self.clone_path)
+ subprocess.check_call(["git", "config", "--replace-all", "branch.test_branch.remote", "remote2"], cwd=self.clone_path)
+ sys.stdout = output = StringIO()
+ wstool_main(cmd)
+ output = output.getvalue()
+ tokens = _nth_line_split(-2, output)
+ self.assertEqual(['clone', 'MV', 'git', 'test_branch', '<', 'remote2/master', '(footag)', self.version_end, "(%s)" % self.version_init, "(%s)" % self.remote_path], tokens)
+ # return remote name to origin
+ subprocess.check_call(["git", "remote", "rename", "remote2", "origin"], cwd=self.clone_path)
+
+ # test when remote is different from origin, no fetch
+ subprocess.check_call(["git", "remote", "add", "remote2", "../../remote"], cwd=self.clone_path)
+ subprocess.check_call(["git", "config", "--replace-all", "branch.test_branch.remote", "remote2"], cwd=self.clone_path)
sys.stdout = output = StringIO()
wstool_main(cmd)
output = output.getvalue()
tokens = _nth_line_split(-2, output)
- self.assertEqual(['clone', 'MV', 'git', 'footag', self.version_end, "(%s)" % self.version_init, os.path.join(self.test_root_path, 'remote')], tokens)
+ self.assertEqual(['clone', 'MV', 'git', 'test_branch', '(footag)', self.version_end, "(%s)" % self.version_init, self.remote_path], tokens)
+
+
+ # test when remote is different from origin, with fetch
+ sys.stdout = output = StringIO()
+ wstool_main(cmd + ['--fetch'])
+ output = output.getvalue()
+ tokens = _nth_line_split(-2, output)
+ self.assertEqual(['clone', 'MV', 'git', 'test_branch', '<', 'remote2/master', '(footag)', self.version_end, "(%s)" % self.version_init, self.remote_path], tokens)
+
+
+ # return branch back to master
+ subprocess.check_call(["git", "checkout", "master"], cwd=self.clone_path)
# using a denormalized local-name here
subprocess.check_call(["rm", ".rosinstall"], cwd=self.local_path)
@@ -246,17 +298,17 @@ class WstoolInfoGitTest(AbstractSCMTest):
wstool_main(cmd)
output = output.getvalue()
tokens = _nth_line_split(-2, output)
- self.assertEqual(['clone', 'MV', 'git', 'footag', self.version_end, "(%s)" %
- self.version_init, os.path.join(self.test_root_path, 'remote')], tokens)
+ self.assertEqual(['clone', 'MV', 'git', 'master', '(footag)', self.version_end, "(%s)" %
+ self.version_init, self.remote_path], tokens)
# using an absolute path to clone dir here
subprocess.check_call(["rm", ".rosinstall"], cwd=self.local_path)
- _add_to_file(os.path.join(self.local_path, ".rosinstall"), "- other: {local-name: ../ros}\n- git: {local-name: '"+clone_path+"', uri: ../remote, version: \"footag\"}")
+ _add_to_file(os.path.join(self.local_path, ".rosinstall"), "- other: {local-name: ../ros}\n- git: {local-name: '"+self.clone_path+"', uri: ../remote, version: \"footag\"}")
sys.stdout = output = StringIO()
wstool_main(cmd)
output = output.getvalue()
tokens = _nth_line_split(-2, output)
- self.assertEqual([clone_path, 'MV', 'git', 'footag', self.version_end, "(%s)" % self.version_init, os.path.join(self.test_root_path, 'remote')], tokens)
+ self.assertEqual([self.clone_path, 'MV', 'git', 'master', '(footag)', self.version_end, "(%s)" % self.version_init, self.remote_path], tokens)
# using an absolute path here where relative path is shorter to display (also checks x for missing)
subprocess.check_call(["rm", ".rosinstall"], cwd=self.local_path)
@@ -265,3 +317,5 @@ class WstoolInfoGitTest(AbstractSCMTest):
wstool_main(cmd)
output = output.getvalue()
tokens = _nth_line_split(-2, output)
+ localname = os.path.join(os.path.dirname(self.local_path), 'foo')
+ self.assertEqual([localname, 'x', 'git', '(footag)', self.remote_path], tokens)
diff --git a/test/local/test_diff_functions_hg.py b/test/local/test_diff_functions_hg.py
index b502fd0..86f2bb6 100644
--- a/test/local/test_diff_functions_hg.py
+++ b/test/local/test_diff_functions_hg.py
@@ -221,7 +221,7 @@ class WstoolInfoHgTest(AbstractSCMTest):
wstool_main(cmd)
output = output.getvalue()
tokens = _nth_line_split(-2, output)
- self.assertEqual(['clone', 'hg', self.version_end, os.path.join(self.test_root_path, 'remote')], tokens, output)
+ self.assertEqual(['clone', 'hg', 'default', '(-)', self.version_end, os.path.join(self.test_root_path, 'remote')], tokens)
clone_path = os.path.join(self.local_path, "clone")
# make local modifications check
@@ -231,7 +231,7 @@ class WstoolInfoHgTest(AbstractSCMTest):
wstool_main(cmd)
output = output.getvalue()
tokens = _nth_line_split(-2, output)
- self.assertEqual(['clone', 'M', 'hg', self.version_end, os.path.join(self.test_root_path, 'remote')], tokens)
+ self.assertEqual(['clone', 'M', 'hg', 'default', '(-)', self.version_end, os.path.join(self.test_root_path, 'remote')], tokens)
subprocess.check_call(["rm", ".rosinstall"], cwd=self.local_path)
_add_to_file(os.path.join(self.local_path, ".rosinstall"), "- other: {local-name: ../ros}\n- hg: {local-name: clone, uri: ../remote, version: \"footag\"}")
@@ -240,7 +240,7 @@ class WstoolInfoHgTest(AbstractSCMTest):
wstool_main(cmd)
output = output.getvalue()
tokens = _nth_line_split(-2, output)
- self.assertEqual(['clone', 'MV', 'hg', 'footag', self.version_end, "(%s)" % self.version_init, os.path.join(self.test_root_path, 'remote')], tokens)
+ self.assertEqual(['clone', 'MV', 'hg', 'default', '(footag)', self.version_end, "(%s)" % self.version_init, os.path.join(self.test_root_path, 'remote')], tokens)
subprocess.check_call(["rm", "-rf", "clone"], cwd=self.local_path)
os.chdir(self.test_root_path)
@@ -248,4 +248,4 @@ class WstoolInfoHgTest(AbstractSCMTest):
wstool_main(cmd)
output = output.getvalue()
tokens = _nth_line_split(-2, output)
- self.assertEqual(['clone', 'x', 'hg', 'footag', os.path.join(self.test_root_path, 'remote')], tokens)
+ self.assertEqual(['clone', 'x', 'hg', '(footag)', os.path.join(self.test_root_path, 'remote')], tokens)
diff --git a/test/local/test_diff_functions_svn.py b/test/local/test_diff_functions_svn.py
index fc32146..e72cdba 100644
--- a/test/local/test_diff_functions_svn.py
+++ b/test/local/test_diff_functions_svn.py
@@ -115,7 +115,9 @@ Index: clone/modified.txt
@@ -0,0 +1 @@
+foo"""]
for snippet in expected:
- self.assertTrue(snippet in output, output)
+ for line in snippet.splitlines():
+ # assertIn is not supported in Python2.6
+ self.assertTrue(line in output, output)
def test_wstool_diff_svn_outside(self):
"""Test diff output for svn when run outside workspace"""
@@ -261,7 +263,7 @@ class WstoolInfoSvnTest(AbstractSCMTest):
wstool_main(cmd)
output = output.getvalue()
tokens = _nth_line_split(-2, output)
- self.assertEqual(['clone', 'MV', 'svn', '1', self.version_end, "(%s)" % self.version_init, self.svn_uri], tokens)
+ self.assertEqual(['clone', 'MV', 'svn', '1', '(-)', self.version_end, "(%s)" % self.version_init, self.svn_uri], tokens)
subprocess.check_call(["rm", "-rf", "clone"], cwd=self.local_path)
os.chdir(self.test_root_path)
@@ -269,4 +271,4 @@ class WstoolInfoSvnTest(AbstractSCMTest):
wstool_main(cmd)
output = output.getvalue()
tokens = _nth_line_split(-2, output)
- self.assertEqual(['clone', 'x', 'svn', '1', self.svn_uri], tokens)
+ self.assertEqual(['clone', 'x', 'svn', '(-)', self.svn_uri], tokens)
diff --git a/test/scm_test_base.py b/test/scm_test_base.py
index 44649f3..6125f7d 100644
--- a/test/scm_test_base.py
+++ b/test/scm_test_base.py
@@ -162,7 +162,7 @@ class AbstractFakeRosBasedTest(AbstractRosinstallBaseDirTest):
def setUpClass(self):
AbstractRosinstallBaseDirTest.setUpClass()
# create a dir mimicking ros
- self.test_root_path = tempfile.mkdtemp()
+ self.test_root_path = os.path.realpath(tempfile.mkdtemp())
_create_fake_ros_dir(self.test_root_path)
# create a repo in git
self.ros_path = os.path.join(self.test_root_path, "ros")
@@ -192,7 +192,7 @@ class AbstractSCMTest(AbstractRosinstallCLITest):
def setUpClass(self):
"""creates a directory 'ros' mimicking to be a ROS root to rosinstall"""
AbstractRosinstallCLITest.setUpClass()
- self.test_root_path = tempfile.mkdtemp()
+ self.test_root_path = os.path.realpath(tempfile.mkdtemp())
self.directories = {}
self.directories["root"] = self.test_root_path
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/ros/wstool.git
More information about the debian-science-commits
mailing list