Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
open-source
hggitforge
Commits
198c7af59274
Commit
87f074d9
authored
Oct 23, 2020
by
Aurelien Lubert
⌨
Browse files
Fix code to work with Python 3.9
parent
9dfacac4637d
Changes
1
Hide whitespace changes
Inline
Side-by-side
hggitforge/__init__.py
View file @
198c7af5
...
...
@@ -24,7 +24,7 @@ def cmd(description, *args, **kwargs):
check_output
(
*
args
,
**
kwargs
)
except
CalledProcessError
as
ex
:
if
not
quiet
:
print
(
ex
.
output
).
strip
()
print
(
ex
.
output
.
decode
(
"utf-8"
).
strip
()
)
print
(
"Command exited with code %d"
%
ex
.
returncode
)
raise
...
...
@@ -109,7 +109,7 @@ def _gfpull(git_repo):
[
"git"
,
"branch"
,
"--format=%(refname:lstrip=2)"
],
cwd
=
git_repo
)
git_pull_master
(
git_repo
)
for
branch
in
branches
.
splitlines
():
for
branch
in
branches
.
decode
(
"utf-8"
).
splitlines
():
if
branch
!=
"master"
:
try
:
cmd
(
...
...
@@ -156,7 +156,9 @@ def _gfremote(git_repo, git_remote_url, git_branch, hg_bookmark):
def
gfclone
(
ui
,
git_fork_url
,
git_upstream_url
,
working_directory
,
**
opts
):
"""Prepare working directory to work with forge"""
try
:
_gfclone
(
git_fork_url
,
git_upstream_url
,
working_directory
)
_gfclone
(
git_fork_url
.
decode
(
"utf-8"
),
git_upstream_url
.
decode
(
"utf-8"
),
working_directory
.
decode
(
"utf-8"
))
except
CalledProcessError
:
pass
except
ValueError
as
ex
:
...
...
@@ -167,9 +169,9 @@ def gfclone(ui, git_fork_url, git_upstream_url, working_directory, **opts):
def
gfpull
(
ui
,
repo
,
**
opts
):
"""Prepare working directory to work with forge"""
os
.
chdir
(
repo
.
root
)
git_repo
=
ui
.
config
(
"gitrepo"
,
"gitrepo"
)
git_repo
=
ui
.
config
(
b
"gitrepo"
,
b
"gitrepo"
)
try
:
_gfpull
(
git_repo
)
_gfpull
(
git_repo
.
decode
(
"utf-8"
)
)
except
CalledProcessError
:
pass
...
...
@@ -178,9 +180,10 @@ def gfpull(ui, repo, **opts):
def
gfpush
(
ui
,
repo
,
bookmark
,
**
opts
):
"""Prepare working directory to work with forge"""
os
.
chdir
(
repo
.
root
)
git_repo
=
ui
.
config
(
"gitrepo"
,
"gitrepo"
)
git_repo
=
ui
.
config
(
b
"gitrepo"
,
b
"gitrepo"
)
try
:
_gfpush
(
git_repo
,
bookmark
)
_gfpush
(
git_repo
.
decode
(
"utf-8"
),
bookmark
.
decode
(
"utf-8"
))
except
CalledProcessError
:
pass
except
ValueError
as
ex
:
...
...
@@ -191,8 +194,11 @@ def gfpush(ui, repo, bookmark, **opts):
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"
)
git_repo
=
ui
.
config
(
b
"gitrepo"
,
b
"gitrepo"
)
try
:
_gfremote
(
git_repo
,
git_remote_url
,
git_branch
,
hg_bookmark
)
_gfremote
(
git_repo
.
decode
(
"utf-8"
),
git_remote_url
.
decode
(
"utf-8"
),
git_branch
.
decode
(
"utf-8"
),
hg_bookmark
.
decode
(
"utf-8"
))
except
CalledProcessError
:
pass
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment