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
Show more breadcrumbs
mercurial
hg-git
Commits
a5c53e94
Commit
a5c53e94
authored
15 years ago
by
Abderrahim Kitouni
Browse files
Options
Downloads
Patches
Plain Diff
Do not depend on the cache git repository for reference pushing
parent
40838c22
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
git_handler.py
+35
-19
35 additions, 19 deletions
git_handler.py
with
35 additions
and
19 deletions
git_handler.py
+
35
−
19
View file @
a5c53e94
...
...
@@ -588,6 +588,9 @@
return
None
# TODO : this is a huge hack
if
keys
[
0
]
==
'
capabilities^{}
'
:
# nothing on the server yet - first push
changed
[
'
refs/heads/master
'
]
=
self
.
git
.
ref
(
'
master
'
)
if
keys
[
0
]
==
'
capabilities^{}
'
:
# nothing on the server yet - first push
if
not
'
master
'
in
self
.
repo
.
tags
():
tip
=
self
.
repo
.
lookup
(
'
tip
'
)
changed
[
'
refs/heads/master
'
]
=
self
.
map_git_get
(
hex
(
tip
))
...
...
@@ -593,5 +596,4 @@
tags
=
self
.
git
.
get_tags
()
for
tag
,
sha
in
tags
.
iteritems
():
for
tag
,
sha
in
self
.
tags
.
iteritems
():
tag_name
=
'
refs/tags/
'
+
tag
if
tag_name
not
in
refs
:
...
...
@@ -596,6 +598,6 @@
tag_name
=
'
refs/tags/
'
+
tag
if
tag_name
not
in
refs
:
changed
[
tag_name
]
=
sha
changed
[
tag_name
]
=
self
.
map_git_get
(
sha
)
for
ref_name
in
keys
:
parts
=
ref_name
.
split
(
'
/
'
)
...
...
@@ -599,13 +601,24 @@
for
ref_name
in
keys
:
parts
=
ref_name
.
split
(
'
/
'
)
if
parts
[
0
]
==
'
refs
'
:
# strip off 'refs/heads'
if
parts
[
1
]
==
'
heads
'
:
head
=
"
/
"
.
join
([
v
for
v
in
parts
[
2
:]])
local_ref
=
self
.
git
.
ref
(
ref_name
)
if
local_ref
:
if
not
local_ref
==
refs
[
ref_name
]:
changed
[
ref_name
]
=
local_ref
if
parts
[
0
]
==
'
refs
'
and
parts
[
1
]
==
'
heads
'
:
# strip off 'refs/heads'
head
=
"
/
"
.
join
([
v
for
v
in
parts
[
2
:]])
try
:
local_ref
=
self
.
repo
.
lookup
(
head
)
remote_ref
=
self
.
map_hg_get
(
refs
[
ref_name
])
if
remote_ref
:
remotectx
=
self
.
repo
[
remote_ref
]
localctx
=
self
.
repo
[
local_ref
]
if
remotectx
.
ancestor
(
localctx
)
==
remotectx
:
# fast forward push
changed
[
ref_name
]
=
self
.
map_git_get
(
hex
(
local_ref
))
else
:
# XXX: maybe abort completely
ui
.
warn
(
'
not pushing branch %s, please merge
'
%
head
)
except
RepoError
:
# remote_ref is not here
pass
# Also push any local branches not on the server yet
for
head
in
self
.
local_heads
():
...
...
@@ -609,9 +622,10 @@
# Also push any local branches not on the server yet
for
head
in
self
.
local_heads
():
if
not
head
in
refs
:
ref
=
self
.
git
.
ref
(
head
)
changed
[
head
]
=
ref
ref
=
'
refs/heads/
'
+
head
if
not
ref
in
refs
:
node
=
self
.
repo
.
lookup
(
head
)
changed
[
ref
]
=
self
.
map_git_get
(
hex
(
node
))
return
changed
...
...
@@ -710,9 +724,11 @@
self
.
git
.
set_remote_refs
(
self
.
local_heads
(),
remote_name
)
def
local_heads
(
self
):
def
is_local_head
(
item
):
return
item
[
0
].
startswith
(
'
refs/heads
'
)
refs
=
self
.
git
.
get_refs
()
return
dict
(
filter
(
is_local_head
,
refs
.
items
()))
try
:
bms
=
bookmarks
.
parse
(
self
.
repo
)
return
dict
([(
bm
,
self
.
map_git_get
(
hex
(
bms
[
bm
])))
for
bm
in
bms
])
except
AttributeError
:
return
{}
def
import_tags
(
self
,
refs
):
keys
=
refs
.
keys
()
...
...
@@ -721,7 +737,7 @@
for
k
in
keys
[:]:
ref_name
=
k
parts
=
k
.
split
(
'
/
'
)
if
(
parts
[
0
]
==
'
refs
'
and
parts
[
1
]
==
'
tags
'
)
:
if
parts
[
0
]
==
'
refs
'
and
parts
[
1
]
==
'
tags
'
:
ref_name
=
"
/
"
.
join
([
v
for
v
in
parts
[
2
:]])
if
ref_name
[
-
3
:]
==
'
^{}
'
:
ref_name
=
ref_name
[:
-
3
]
...
...
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