has_git = os.path.isdir(".git")
has_scripts = os.path.isdir(".scripts")
-<<<<<<< HEAD
- # deal with old-style migration
- if os.path.isfile(".scripts/old-version") and not os.path.isfile(".scripts-version"):
- os.rename(".scripts/old-version", ".scripts-version")
-
- if not has_git and has_scripts:
- if not options.force:
- raise CorruptedAutoinstallError(dir)
- elif has_git and not has_scripts:
- # can't force this
- raise AlreadyVersionedError(dir)
- elif has_git and has_scripts:
- if not options.force:
- raise AlreadyMigratedError(dir)
-
- if options.force:
- def rm_with_backup(file):
- prefix = "%s.bak" % file
- name = None
- for i in itertools.count():
- name = "%s.%d" % (prefix, i)
- if not os.path.exists(name):
- break
- logging.warning("Force removing %s directory (backup at %s)" % (file, name))
- os.rename(file, name)
- if has_git:
- if not options.dry_run:
- rm_with_backup(".git")
- if has_scripts:
- if not options.dry_run:
- rm_with_backup(".scripts")
-
-def make_deployment():
- try:
- return deploy.Deployment(".")
- except IOError as e:
- if e.errno == errno.ENOENT:
- raise NotAutoinstallError(dir)
- else: raise e
-
-def check_if_tag_exists(sh, repo, tag, version):
- # check if the version we're trying to convert exists. We assume
- # a convention here, namely, app-1.2.3-scripts is what we want. If
- # you broke the convention... shame on you.
- try:
- sh.call("git", "--git-dir", repo, "rev-parse", tag)
- except shell.CallError:
- raise NoTagError(version)
-=======
if has_git:
logging.warning("Force removing .git directory")
if not options.dry_run: backup = safe_unlink(".git")
break
os.rename(file, name)
return name
->>>>>>> 255245146b500845fa13a75bfbeb6cece074417c
def make_repository(sh, options, repo, tag):
sh.call("git", "init") # create repository