Mailinglist Archive: opensuse-buildservice (250 mails)

< Previous Next >
[opensuse-buildservice] [PATCH] osc co package if cwd is a project directory
  • From: Brandon Philips <brandon@xxxxxxxx>
  • Date: Thu, 16 Apr 2009 17:39:33 -0700
  • Message-id: <20090417003933.GD3992@xxxxxxxxxxxxxxxx>
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 <bphilips@xxxxxxx>


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@xxxxxxxxxxxx
For additional commands, e-mail: opensuse-buildservice+help@xxxxxxxxxxxx

< Previous Next >