Peter suggested this idea a while ago. It makes sense to me. Thoughts?
If no one objects I will commit it later.
If you are currently in an osc project and only provide checkout with a
package name it will checkout that package to the cwd.
Example usage:
~> cd home\:philipsb/
~/home:philipsb> osc co abook
A /home/philips/home:philipsb/abook
A /home/philips/home:philipsb/abook/abook-0.5.6.tar.gz
A /home/philips/home:philipsb/abook/abook.spec
~/home:philipsb>
Signed-off-by: Brandon Philips
Index: osc/commandline.py
===================================================================
--- osc/commandline.py (revision 7102)
+++ osc/commandline.py (working copy)
@@ -1130,9 +1130,10 @@
osc co Apache # entire project
osc co Apache apache2 # a package
osc co Apache apache2 foo # single file -> to current dir
+ osc co apache2 # package from cwd's project
usage:
- osc co PROJECT [PACKAGE] [FILE]
+ osc co [PROJECT] [PACKAGE] [FILE]
${cmd_option_list}
"""
@@ -1141,12 +1142,18 @@
args = slash_split(args)
project = package = filename = None
- try:
- project = args[0]
- package = args[1]
- filename = args[2]
- except:
- pass
+ cwd = os.getcwd()
+ if len(args) == 1 and is_project_dir(cwd):
+ package = args[0]
+ project = store_read_project(cwd)
+ opts.current_dir = True
+ else:
+ try:
+ project = args[0]
+ package = args[1]
+ filename = args[2]
+ except:
+ pass
rev, dummy = parseRevisionOption(opts.revision)
--
To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-buildservice+help@opensuse.org