Commit 2bdd36fe authored by Elouan Martinet's avatar Elouan Martinet
Browse files

Reformat using black

parent 8278d0f68560
......@@ -15,34 +15,35 @@ command = registrar.command(cmdtable)
def git_clone(path_url, destination):
ret_code = call(['git', 'clone', path_url, destination, '--bare'])
ret_code = call(["git", "clone", path_url, destination, "--bare"])
print(ret_code)
def hg_clone(path, destination):
ret_code = call(['hg', 'clone', path, destination])
ret_code = call(["hg", "clone", path, destination])
print(ret_code)
ret_code = call(['hg', 'phase', '-p', 'master'], cwd=destination)
ret_code = call(["hg", "phase", "-p", "master"], cwd=destination)
print(ret_code)
def update_hgrc(git_repo, hg_repo):
hgrc_path = osp.join(hg_repo, '.hg', 'hgrc')
with open(hgrc_path, 'a') as fobj:
fobj.write('\n')
fobj.write('[gitrepo]\n')
fobj.write('gitrepo = {}\n'.format(git_repo))
hgrc_path = osp.join(hg_repo, ".hg", "hgrc")
with open(hgrc_path, "a") as fobj:
fobj.write("\n")
fobj.write("[gitrepo]\n")
fobj.write("gitrepo = {}\n".format(git_repo))
def _ghclone(path_url, destination):
project_name = osp.split(destination)[-1]
git_repo = osp.abspath(
osp.join(destination, 'git_{}'.format(project_name)))
hg_repo = osp.abspath(
osp.join(destination, 'hg_{}'.format(project_name)))
git_repo = osp.abspath(osp.join(destination, "git_{}".format(project_name)))
hg_repo = osp.abspath(osp.join(destination, "hg_{}".format(project_name)))
if osp.isdir(destination):
raise ValueError(
'Destination directory {} for hg repository should not exist'.format(destination))
"Destination directory {} for hg repository should not exist".format(
destination
)
)
else:
os.mkdir(destination)
os.mkdir(hg_repo)
......@@ -51,36 +52,29 @@ def _ghclone(path_url, destination):
update_hgrc(git_repo, hg_repo)
@command('ghclone',
[],
_('git_path working_directory'), norepo=True)
@command("ghclone", [], _("git_path working_directory"), norepo=True)
def ghclone(ui, git_url, working_directory, **opts):
"""Prepare working directory to work with github"""
_ghclone(git_url, working_directory)
@command('ghpull',
[],
_(''))
@command("ghpull", [], _(""))
def ghpull(ui, repo, **opts):
"""Prepare working directory to work with github"""
git_repo = ui.config('gitrepo', 'gitrepo')
ret_code = call(['git', 'fetch', '-q', 'origin', 'master:master'], cwd=git_repo)
ret_code = call(['hg', 'pull'])
ret_code = call(['hg', 'phase', '-p', 'master'])
@command('ghpush',
[],
_('bookmark'))
git_repo = ui.config("gitrepo", "gitrepo")
ret_code = call(["git", "fetch", "-q", "origin", "master:master"], cwd=git_repo)
ret_code = call(["hg", "pull"])
ret_code = call(["hg", "phase", "-p", "master"])
@command("ghpush", [], _("bookmark"))
def ghpush(ui, repo, bookmark, **opts):
"""Prepare working directory to work with github"""
git_repo = ui.config('gitrepo', 'gitrepo')
ret_code = call(['hg', 'push', '-B', bookmark, '-f'])
#ret_code = call(['git', 'push', '--set-upstream',
git_repo = ui.config("gitrepo", "gitrepo")
ret_code = call(["hg", "push", "-B", bookmark, "-f"])
# ret_code = call(['git', 'push', '--set-upstream',
# 'origin', bookmark, '--force-with-lease'], cwd=git_repo)
ret_code = call(['git', 'push', '--set-upstream',
'origin', bookmark, '-f'], cwd=git_repo)
ret_code = call(
["git", "push", "--set-upstream", "origin", bookmark, "-f"],
cwd=git_repo,
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment