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@suse.de
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)
On Friday 17 of April 2009 02:39:33 Brandon Philips wrote:
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.
+1
It's really annoying to type cd .. before checkout and fill a project name even if it's stored in .osc/_project.
[snip] Regards Michal Vyskocil
Am Freitag, 17. April 2009 10:09:09 schrieb Michal Vyskocil:
On Friday 17 of April 2009 02:39:33 Brandon Philips wrote:
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.
+1
It's really annoying to type cd .. before checkout and fill a project name even if it's stored in .osc/_project.
That is an easy one, implemented in svn -> upcoming osc 0.117
bye adrian
On 10:35 Fri 17 Apr 2009, Adrian Schröter wrote:
Am Freitag, 17. April 2009 10:09:09 schrieb Michal Vyskocil:
On Friday 17 of April 2009 02:39:33 Brandon Philips wrote:
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.
+1
It's really annoying to type cd .. before checkout and fill a project name even if it's stored in .osc/_project.
That is an easy one, implemented in svn -> upcoming osc 0.117
Thanks for committing the change but I do have commit rights and was just looking for review.
I looked at the commit and I am confused at why all of the other change were necessary in the same commit. Also, you broke the new feature I added in r7102....!
$ svn diff -r7102:7103
Index: osc/build.py
--- osc/build.py (revision 7102) +++ osc/build.py (revision 7103) @@ -352,7 +352,7 @@ bi_file.flush()
bi = Buildinfo(bi_file.name, apiurl)
- if bi.debuginfo and not (opts.debuginfo or opts.disable_debuginfo):
- if bi.debuginfo and not opts.disable_debuginfo:
What is this about?
buildargs.append('--debug') buildargs = ' '.join(set(buildargs))
Index: osc/commandline.py
--- osc/commandline.py (revision 7102) +++ osc/commandline.py (revision 7103) @@ -1124,15 +1124,17 @@ When a package is a source link, then it will be checked out in expanded form. If --unexpand-link option is used, the checkout will instead produce the raw _link file plus patches.
examples:
osc co Apache # entire project
osc co Apache apache2 # a package
osc co Apache apache2 foo # single file -> to current dir
usage: osc co PROJECT [PACKAGE] [FILE]
osc co PROJECT # entire project
osc co PACKAGE # checksout a package, when local directory is a checkout package
checks out
I don't think that comment is correct. It checks out a package to the local directory when the cwd is a _project_ directory.
osc co PROJECT PACKAGE # a package
osc co PROJECT PACKAGE FILE # single file -> to current dir
inside a checked out local project directory:
osc co PACKAGE
This is a clear way of saying it. I say just remove the above note.
${cmd_option_list} """
@@ -1141,13 +1143,20 @@
args = slash_split(args) project = package = filename = None
apiurl = conf.config['apiurl']
Why introduce this cleanup in the same patch?
try:
project = args[0]
project = project_dir = args[0]
What is that about? project_dir = args[0]?
package = args[1] filename = args[2] except: pass
if args and len(args) == 1:
if is_project_dir(os.getcwd()):
project = Project(os.getcwd()).name
project_dir = "."
package = args[0]
apiurl = Project(os.getcwd()).apiurl rev, dummy = parseRevisionOption(opts.revision)
@@ -1156,34 +1165,31 @@ sys.exit(1)
if filename:
get_source_file(conf.config['apiurl'], project, package, filename, revision=rev)
get_source_file(apiurl, project, package, filename, revision=rev) elif package:
if opts.current_dir: prj_dir = None
else: prj_dir = project
NACK. You just broke the -c flag I committed in r7102
Can I reintroduce this change?
checkout_package(apiurl, project, package,
rev, expand_link=expand_link, prj_dir=project_dir)
checkout_package(conf.config['apiurl'], project, package,
rev, expand_link=expand_link, prj_dir=prj_dir)
This all should have been in a separate commit.
elif project: if os.path.exists(project): sys.exit('osc: project \'%s\' already exists' % project) # check if the project does exist (show_project_meta will throw an exception)
show_project_meta(conf.config['apiurl'], project)
show_project_meta(apiurl, project)
init_project_dir(conf.config['apiurl'], project, project)
init_project_dir(apiurl, project, project) print statfrmt('A', project) # all packages
for package in meta_get_packagelist(conf.config['apiurl'], project):
for package in meta_get_packagelist(apiurl, project): try:
checkout_package(conf.config['apiurl'], project, package,
checkout_package(apiurl, project, package, expand_link=expand_link, prj_dir=project) except oscerr.LinkExpandError, e: print >>sys.stderr, 'Link cannot be expanded:\n', e # check out in unexpanded form at least
checkout_package(conf.config['apiurl'], project, package,
checkout_package(apiurl, project, package, expand_link=False, prj_dir=project) else:
Adrian-
Ping? We need to address the problems with this checkin. Specifically that it broke the feature added in r7102.
Thanks,
Brandon
On 08:10 Fri 17 Apr 2009, Brandon Philips wrote:
On 10:35 Fri 17 Apr 2009, Adrian Schröter wrote:
Am Freitag, 17. April 2009 10:09:09 schrieb Michal Vyskocil:
On Friday 17 of April 2009 02:39:33 Brandon Philips wrote:
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.
+1
It's really annoying to type cd .. before checkout and fill a project name even if it's stored in .osc/_project.
That is an easy one, implemented in svn -> upcoming osc 0.117
Thanks for committing the change but I do have commit rights and was just looking for review.
I looked at the commit and I am confused at why all of the other change were necessary in the same commit. Also, you broke the new feature I added in r7102....!
$ svn diff -r7102:7103
Index: osc/build.py
--- osc/build.py (revision 7102) +++ osc/build.py (revision 7103) @@ -352,7 +352,7 @@ bi_file.flush()
bi = Buildinfo(bi_file.name, apiurl)
- if bi.debuginfo and not (opts.debuginfo or opts.disable_debuginfo):
- if bi.debuginfo and not opts.disable_debuginfo:
What is this about?
buildargs.append('--debug') buildargs = ' '.join(set(buildargs))
Index: osc/commandline.py
--- osc/commandline.py (revision 7102) +++ osc/commandline.py (revision 7103) @@ -1124,15 +1124,17 @@ When a package is a source link, then it will be checked out in expanded form. If --unexpand-link option is used, the checkout will instead produce the raw _link file plus patches.
examples:
osc co Apache # entire project
osc co Apache apache2 # a package
osc co Apache apache2 foo # single file -> to current dir
usage: osc co PROJECT [PACKAGE] [FILE]
osc co PROJECT # entire project
osc co PACKAGE # checksout a package, when local directory is a checkout package
checks out
I don't think that comment is correct. It checks out a package to the local directory when the cwd is a _project_ directory.
osc co PROJECT PACKAGE # a package
osc co PROJECT PACKAGE FILE # single file -> to current dir
inside a checked out local project directory:
osc co PACKAGE
This is a clear way of saying it. I say just remove the above note.
${cmd_option_list} """
@@ -1141,13 +1143,20 @@
args = slash_split(args) project = package = filename = None
apiurl = conf.config['apiurl']
Why introduce this cleanup in the same patch?
try:
project = args[0]
project = project_dir = args[0]
What is that about? project_dir = args[0]?
package = args[1] filename = args[2] except: pass
if args and len(args) == 1:
if is_project_dir(os.getcwd()):
project = Project(os.getcwd()).name
project_dir = "."
package = args[0]
apiurl = Project(os.getcwd()).apiurl rev, dummy = parseRevisionOption(opts.revision)
@@ -1156,34 +1165,31 @@ sys.exit(1)
if filename:
get_source_file(conf.config['apiurl'], project, package, filename, revision=rev)
get_source_file(apiurl, project, package, filename, revision=rev) elif package:
if opts.current_dir: prj_dir = None
else: prj_dir = project
NACK. You just broke the -c flag I committed in r7102
Can I reintroduce this change?
checkout_package(apiurl, project, package,
rev, expand_link=expand_link, prj_dir=project_dir)
checkout_package(conf.config['apiurl'], project, package,
rev, expand_link=expand_link, prj_dir=prj_dir)
This all should have been in a separate commit.
elif project: if os.path.exists(project): sys.exit('osc: project \'%s\' already exists' % project) # check if the project does exist (show_project_meta will throw an exception)
show_project_meta(conf.config['apiurl'], project)
show_project_meta(apiurl, project)
init_project_dir(conf.config['apiurl'], project, project)
init_project_dir(apiurl, project, project) print statfrmt('A', project) # all packages
for package in meta_get_packagelist(conf.config['apiurl'], project):
for package in meta_get_packagelist(apiurl, project): try:
checkout_package(conf.config['apiurl'], project, package,
checkout_package(apiurl, project, package, expand_link=expand_link, prj_dir=project) except oscerr.LinkExpandError, e: print >>sys.stderr, 'Link cannot be expanded:\n', e # check out in unexpanded form at least
checkout_package(conf.config['apiurl'], project, package,
checkout_package(apiurl, project, package, expand_link=False, prj_dir=project) else:
On Thu, Apr 16, 2009 at 05:39:33PM -0700, Brandon Philips wrote:
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.
Cool! I hate to write the project names (especially with those colons that break bash completion) again and again.
buildservice@lists.opensuse.org