Commit 32fa4caa authored by Elouan Martinet's avatar Elouan Martinet
Browse files

Rename commands from gh to gf

parent c67a385fadbf
......@@ -87,7 +87,7 @@ def hg_pull():
cmd("Publishing master bookmark", ["hg", "phase", "-p", "master"])
def _ghclone(git_fork_url, git_upstream_url, destination):
def _gfclone(git_fork_url, git_upstream_url, destination):
working_dir, project_name = osp.split(destination)
git_repo = osp.abspath(osp.join(working_dir, ".%s.git" % project_name))
if osp.isdir(destination):
......@@ -104,7 +104,7 @@ def _ghclone(git_fork_url, git_upstream_url, destination):
update_hgrc(destination)
def _ghpull(git_repo):
def _gfpull(git_repo):
branches = check_output(
["git", "branch", "--format=%(refname:lstrip=2)"], cwd=git_repo
)
......@@ -123,7 +123,7 @@ def _ghpull(git_repo):
hg_pull()
def _ghpush(git_repo, bookmark):
def _gfpush(git_repo, bookmark):
if bookmark == "master":
raise ValueError("Cannot push master branch")
cmd(
......@@ -138,7 +138,7 @@ def _ghpush(git_repo, bookmark):
)
def _ghremote(git_repo, git_remote_url, git_branch, hg_bookmark):
def _gfremote(git_repo, git_remote_url, git_branch, hg_bookmark):
if hg_bookmark == "master":
raise ValueError("Cannot replace master bookmark")
cmd(
......@@ -151,48 +151,48 @@ def _ghremote(git_repo, git_remote_url, git_branch, hg_bookmark):
@command(
b"ghclone", [], _("git_fork_path git_upstream_path working_directory"), norepo=True
b"gfclone", [], _("git_fork_path git_upstream_path working_directory"), norepo=True
)
def ghclone(ui, git_fork_url, git_upstream_url, working_directory, **opts):
def gfclone(ui, git_fork_url, git_upstream_url, working_directory, **opts):
"""Prepare working directory to work with forge"""
try:
_ghclone(git_fork_url, git_upstream_url, working_directory)
_gfclone(git_fork_url, git_upstream_url, working_directory)
except CalledProcessError:
pass
except ValueError as ex:
print(ex)
@command(b"ghpull", [], _(""))
def ghpull(ui, repo, **opts):
@command(b"gfpull", [], _(""))
def gfpull(ui, repo, **opts):
"""Prepare working directory to work with forge"""
os.chdir(repo.root)
git_repo = ui.config("gitrepo", "gitrepo")
try:
_ghpull(git_repo)
_gfpull(git_repo)
except CalledProcessError:
pass
@command(b"ghpush", [], _("bookmark"))
def ghpush(ui, repo, bookmark, **opts):
@command(b"gfpush", [], _("bookmark"))
def gfpush(ui, repo, bookmark, **opts):
"""Prepare working directory to work with forge"""
os.chdir(repo.root)
git_repo = ui.config("gitrepo", "gitrepo")
try:
_ghpush(git_repo, bookmark)
_gfpush(git_repo, bookmark)
except CalledProcessError:
pass
except ValueError as ex:
print(ex)
@command(b"ghremote", [], _("git_remote_path git_branch hg_bookmark"))
def ghremote(ui, repo, git_remote_url, git_branch, hg_bookmark, **opts):
@command(b"gfremote", [], _("git_remote_path git_branch hg_bookmark"))
def gfremote(ui, repo, git_remote_url, git_branch, hg_bookmark, **opts):
"""Pull remote branch from alternate Git repository"""
os.chdir(repo.root)
git_repo = ui.config("gitrepo", "gitrepo")
try:
_ghremote(git_repo, git_remote_url, git_branch, hg_bookmark)
_gfremote(git_repo, git_remote_url, git_branch, hg_bookmark)
except CalledProcessError:
pass
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