Skip to content
This repository was archived by the owner on Jun 25, 2020. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion completion/wstool-completion.bash
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ fi

# put here to be extendable
if [ -z "$WSTOOL_BASE_COMMANDS" ]; then
_WSTOOL_BASE_COMMANDS="help init set merge info remove diff status update export --version"
_WSTOOL_BASE_COMMANDS="help init set merge info scrape remove diff status update export --version"
fi

# Based originally on the bzr/svn bash completition scripts.
Expand Down Expand Up @@ -116,6 +116,9 @@ _wstool_complete()
info)
cmdOpts="-t --target-workspace --data-only --no-pkg-path --pkg-path-only --only --yaml -u --untracked --fetch -s --short --root -m --managed-only"
;;
scrape)
cmdOpts="-y --confirm -t --target-workspace -v --versioned"
;;
*)
;;
esac
Expand Down
2 changes: 1 addition & 1 deletion src/wstool/cli_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def get_info_table(basepath, entries, data_only=False, reverse=False,
])
# table design
if unmanaged:
selected_headers = ['localname', 'scm', 'uri']
selected_headers = ['localname', 'scm', 'uri', 'version']
elif selected_headers is None:
selected_headers = headers.keys()
# validate selected_headers
Expand Down
8 changes: 7 additions & 1 deletion src/wstool/multiproject_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1327,9 +1327,12 @@ def cmd_scrape(self, target_path, argv, config=None):
usage=usage,
description=__MULTIPRO_CMD_DICT__["scrape"],
epilog="See: http://www.ros.org/wiki/rosinstall for details\n")
parser.add_option("-y", "--confirm", dest="confirm", default='',
parser.add_option("-y", "--confirm", dest="confirm", default=False,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please also update the bash completions if adding command-line options: https://github.com/vcstools/wstool/blob/master/completion/wstool-completion.bash

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scrape wasn't in the bash completion list before, but I added it with all its options now 😉

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🙌

help="Do not ask for confirmation",
action="store_true")
parser.add_option("-v", "--versioned", dest="versioned", default=False,
help="Remember current version label",
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,
Expand Down Expand Up @@ -1357,5 +1360,8 @@ def cmd_scrape(self, target_path, argv, config=None):
args = [elem_abs_path, elem['scm'], elem['uri']]
if (options.confirm):
args.append('-y')
if (options.versioned and elem['version']):
args.append('-v')
args.append(elem['version'])
self.cmd_set(target_path, args)
return 0
3 changes: 2 additions & 1 deletion src/wstool/multiproject_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,7 @@ def do_work(self):
'localname': self.localname,
'path': self.path,
'uri': vcsc.get_url(),
'version': vcsc.get_current_version_label(),
'properties': self.element.get_properties()}

path = config.get_base_path()
Expand All @@ -579,7 +580,7 @@ def do_work(self):
managed_paths = [os.path.join(path, e.get_local_name()) for e in elements]
unmanaged_paths = []
scm_clients = {SvnClient: 'svn', GitClient: 'git', BzrClient:'bzr', HgClient:'hg'}
for root, dirs, files in os.walk(path):
for root, dirs, files in os.walk(path, followlinks=True):
if root in managed_paths:
# remove it from the walk if it's managed
del dirs[:]
Expand Down
2 changes: 1 addition & 1 deletion test/local/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ def test_info_table(self):
'localname': 'localname',
'specversion': 'specversion',
'actualversion': 'actualversion'}]
self.assertEqual(["localname", "scm", "uri"], _nth_line_split(-1, wstool.cli_common.get_info_table(basepath, entries, unmanaged=True)))
self.assertEqual(["localname", "scm", "uri", "version"], _nth_line_split(-1, wstool.cli_common.get_info_table(basepath, entries, unmanaged=True)))

def test_info_list(self):
basepath = '/foo/path'
Expand Down