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
b1d6c7fe
Commit
b1d6c7fe
authored
15 years ago
by
Tay Ray Chuan
Browse files
Options
Downloads
Plain Diff
Merge branch 'rc/push-tag' into rc/master
parents
dda51b4e
53b0d608
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
hggit/git_handler.py
+27
-0
27 additions, 0 deletions
hggit/git_handler.py
tests/test-git-tags
+6
-1
6 additions, 1 deletion
tests/test-git-tags
tests/test-git-tags.out
+6
-0
6 additions, 0 deletions
tests/test-git-tags.out
with
39 additions
and
1 deletion
hggit/git_handler.py
+
27
−
0
View file @
b1d6c7fe
...
...
@@ -568,6 +568,30 @@
raise
hgutil
.
Abort
(
"
revision %s cannot be pushed since
"
"
it doesn
'
t have a ref
"
%
ctx
)
# Check if the tags the server is advertising are annotated tags,
# by attempting to retrieve it from the our git repo, and building a
# list of these tags.
#
# This is possible, even though (currently) annotated tags are
# dereferenced and stored as lightweight ones, as the annotated tag
# is still stored in the git repo.
uptodate_annotated_tags
=
[]
for
r
in
tags
:
ref
=
'
refs/tags/
'
+
r
# Check tag.
if
not
ref
in
refs
:
continue
try
:
# We're not using Repo.tag(), as it's deprecated.
tag
=
self
.
git
.
get_object
(
refs
[
ref
])
if
not
isinstance
(
tag
,
Tag
):
continue
except
KeyError
:
continue
# If we've reached here, the tag's good.
uptodate_annotated_tags
.
append
(
ref
)
for
r
in
heads
+
tags
:
if
r
in
heads
:
ref
=
'
refs/heads/
'
+
r
...
...
@@ -583,6 +607,9 @@
else
:
raise
hgutil
.
Abort
(
"
pushing %s overwrites %s
"
%
(
ref
,
ctx
))
elif
ref
in
uptodate_annotated_tags
:
# we already have the annotated tag.
pass
else
:
raise
hgutil
.
Abort
(
"
%s changed on the server, please pull
"
"
and merge before pushing
"
%
ref
)
...
...
This diff is collapsed.
Click to expand it.
tests/test-git-tags
+
6
−
1
View file @
b1d6c7fe
...
...
@@ -40,6 +40,7 @@
mkdir
gitrepo
cd
gitrepo
git init | python
-c
"import sys; print sys.stdin.read().replace('
$(
dirname
$(
pwd
))
/', '')"
git config receive.denyCurrentBranch ignore
echo
alpha
>
alpha
git add alpha
commit
-m
'add alpha'
...
...
@@ -56,9 +57,10 @@
--listen
=
localhost
\
--export-all
\
--pid-file
=
gitdaemon.pid
\
--detach
--reuseaddr
--detach
--reuseaddr
\
--enable
=
receive-pack
hg clone git://localhost/gitrepo hgrepo |
grep
-v
'^updating'
cd
hgrepo
hg log
--graph
...
...
@@ -60,8 +62,11 @@
hg clone git://localhost/gitrepo hgrepo |
grep
-v
'^updating'
cd
hgrepo
hg log
--graph
echo
beta-fix
>>
beta
hg commit
-m
'fix for beta'
hg push
cd
..
kill
`
cat
gitdaemon.pid
`
This diff is collapsed.
Click to expand it.
tests/test-git-tags.out
+
6
−
0
View file @
b1d6c7fe
...
...
@@ -21,3 +21,9 @@
date: Mon Jan 01 00:00:10 2007 +0000
summary: add alpha
pushing to git://localhost/gitrepo
importing Hg objects into Git
creating and sending data
default::refs/tags/beta => GIT:e6f255c6
default::refs/tags/alpha => GIT:7eeab2ea
default::refs/heads/master => GIT:3b7fd1b3
...
...
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