summaryrefslogtreecommitdiffstats
path: root/repo
diff options
context:
space:
mode:
Diffstat (limited to 'repo')
-rwxr-xr-xrepo29
1 files changed, 17 insertions, 12 deletions
diff --git a/repo b/repo
index 277bbc6e..56d784fb 100755
--- a/repo
+++ b/repo
@@ -110,6 +110,7 @@ REPO_MAIN = S_repo + '/main.py' # main script
110MIN_PYTHON_VERSION = (2, 6) # minimum supported python version 110MIN_PYTHON_VERSION = (2, 6) # minimum supported python version
111 111
112 112
113import errno
113import optparse 114import optparse
114import os 115import os
115import re 116import re
@@ -180,6 +181,10 @@ group.add_option('--reference',
180group.add_option('--depth', type='int', default=None, 181group.add_option('--depth', type='int', default=None,
181 dest='depth', 182 dest='depth',
182 help='create a shallow clone with given depth; see git clone') 183 help='create a shallow clone with given depth; see git clone')
184group.add_option('--archive',
185 dest='archive', action='store_true',
186 help='checkout an archive instead of a git repository for '
187 'each project. See git archive.')
183group.add_option('-g', '--groups', 188group.add_option('-g', '--groups',
184 dest='groups', default='default', 189 dest='groups', default='default',
185 help='restrict manifest projects to ones with specified ' 190 help='restrict manifest projects to ones with specified '
@@ -239,10 +244,10 @@ def _Init(args):
239 _print("fatal: invalid branch name '%s'" % branch, file=sys.stderr) 244 _print("fatal: invalid branch name '%s'" % branch, file=sys.stderr)
240 raise CloneFailure() 245 raise CloneFailure()
241 246
242 if not os.path.isdir(repodir): 247 try:
243 try: 248 os.mkdir(repodir)
244 os.mkdir(repodir) 249 except OSError as e:
245 except OSError as e: 250 if e.errno != errno.EEXIST:
246 _print('fatal: cannot make %s directory: %s' 251 _print('fatal: cannot make %s directory: %s'
247 % (repodir, e.strerror), file=sys.stderr) 252 % (repodir, e.strerror), file=sys.stderr)
248 # Don't raise CloneFailure; that would delete the 253 # Don't raise CloneFailure; that would delete the
@@ -321,18 +326,18 @@ def NeedSetupGnuPG():
321 326
322 327
323def SetupGnuPG(quiet): 328def SetupGnuPG(quiet):
324 if not os.path.isdir(home_dot_repo): 329 try:
325 try: 330 os.mkdir(home_dot_repo)
326 os.mkdir(home_dot_repo) 331 except OSError as e:
327 except OSError as e: 332 if e.errno != errno.EEXIST:
328 _print('fatal: cannot make %s directory: %s' 333 _print('fatal: cannot make %s directory: %s'
329 % (home_dot_repo, e.strerror), file=sys.stderr) 334 % (home_dot_repo, e.strerror), file=sys.stderr)
330 sys.exit(1) 335 sys.exit(1)
331 336
332 if not os.path.isdir(gpg_dir): 337 try:
333 try: 338 os.mkdir(gpg_dir, stat.S_IRWXU)
334 os.mkdir(gpg_dir, stat.S_IRWXU) 339 except OSError as e:
335 except OSError as e: 340 if e.errno != errno.EEXIST:
336 _print('fatal: cannot make %s directory: %s' % (gpg_dir, e.strerror), 341 _print('fatal: cannot make %s directory: %s' % (gpg_dir, e.strerror),
337 file=sys.stderr) 342 file=sys.stderr)
338 sys.exit(1) 343 sys.exit(1)