diff --git a/osc/commandline.py b/osc/commandline.py index 63804c5a..f33644bb 100755 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -665,6 +665,12 @@ class Osc(cmdln.Cmdln): checkout_package(conf.config['apiurl'], project, package, rev) elif project: + if not os.path.exists(project): + init_project_dir(conf.config['apiurl'], project, project) + print statfrmt('A', project) + else: + print >>sys.stderr, 'osc: project \'%s\' already exists' % project + sys.exit(1) # all packages for package in meta_get_packagelist(conf.config['apiurl'], project): checkout_package(conf.config['apiurl'], project, package) diff --git a/osc/core.py b/osc/core.py index 3bd76b7b..4985e985 100755 --- a/osc/core.py +++ b/osc/core.py @@ -829,6 +829,13 @@ def urlopen(url, data=None): return fd +def init_project_dir(apiurl, dir, project): + if not os.path.exists(dir): + os.mkdir(dir) + os.mkdir(os.path.join(dir, store)) + + store_write_project(dir, project) + store_write_apiurl(dir, apiurl) def init_package_dir(apiurl, project, package, dir, revision=None): if not os.path.isdir(store): @@ -1437,11 +1444,7 @@ def make_dir(apiurl, project, package): #print "creating directory '%s'" % project if not os.path.exists(project): print statfrmt('A', project) - os.mkdir(project) - os.mkdir(os.path.join(project, store)) - - store_write_project(project, project) - store_write_apiurl(project, apiurl) + init_project_dir(apiurl, project, project) #print "creating directory '%s/%s'" % (project, package) if not os.path.exists(os.path.join(project, package)):