Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
hg-git
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Admin message
This instance will be upgraded to Heptapod 17.9.2 on 2025-04-24 between 17:00 and 18:00 UTC+2
Show more breadcrumbs
mercurial
hg-git
Commits
31f52d62
Commit
31f52d62
authored
9 years ago
by
Sean Farley
Browse files
Options
Downloads
Patches
Plain Diff
compat: add method for dulwich to return the symref
parent
6faa3391
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hggit/compat.py
+25
-0
25 additions, 0 deletions
hggit/compat.py
with
25 additions
and
0 deletions
hggit/compat.py
+
25
−
0
View file @
31f52d62
...
...
@@ -35,3 +35,28 @@
except
TypeError
:
# compat with hg < 3.9
return
url
.
passwordmgr
(
ui
)
# dulwich doesn't return the symref where remote HEAD points, so we monkey
# patch it here
from
dulwich.errors
import
GitProtocolError
from
dulwich.protocol
import
extract_capabilities
def
read_pkt_refs
(
proto
):
server_capabilities
=
None
refs
=
{}
# Receive refs from server
for
pkt
in
proto
.
read_pkt_seq
():
(
sha
,
ref
)
=
pkt
.
rstrip
(
'
\n
'
).
split
(
None
,
1
)
if
sha
==
'
ERR
'
:
raise
GitProtocolError
(
ref
)
if
server_capabilities
is
None
:
(
ref
,
server_capabilities
)
=
extract_capabilities
(
ref
)
symref
=
'
symref=HEAD:
'
for
cap
in
server_capabilities
:
if
cap
.
startswith
(
symref
):
sha
=
cap
.
replace
(
symref
,
''
)
refs
[
ref
]
=
sha
if
len
(
refs
)
==
0
:
return
None
,
set
([])
return
refs
,
set
(
server_capabilities
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment