Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
mercurial-devel
Manage
Activity
Members
Labels
Plan
Wiki
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
Environments
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
mercurial-devel
Commits
e1a145ee
Commit
e1a145ee
authored
14 years ago
by
Matt Mackall
Browse files
Options
Downloads
Patches
Plain Diff
bookmarks: add support for push --bookmark to export bookmarks
parent
cb21fb1b
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
hgext/bookmarks.py
+39
-0
39 additions, 0 deletions
hgext/bookmarks.py
with
39 additions
and
0 deletions
hgext/bookmarks.py
+
39
−
0
View file @
e1a145ee
...
...
@@ -409,6 +409,42 @@
return
result
def
push
(
oldpush
,
ui
,
repo
,
dest
=
None
,
**
opts
):
dopush
=
True
if
opts
.
get
(
'
bookmark
'
):
dopush
=
False
for
b
in
opts
[
'
bookmark
'
]:
if
b
in
repo
.
_bookmarks
:
dopush
=
True
opts
.
setdefault
(
'
rev
'
,
[]).
append
(
b
)
result
=
0
if
dopush
:
result
=
oldpush
(
ui
,
repo
,
dest
,
**
opts
)
if
opts
.
get
(
'
bookmark
'
):
# this is an unpleasant hack as push will do this internally
dest
=
ui
.
expandpath
(
dest
or
'
default-push
'
,
dest
or
'
default
'
)
dest
,
branches
=
hg
.
parseurl
(
dest
,
opts
.
get
(
'
branch
'
))
other
=
hg
.
repository
(
hg
.
remoteui
(
repo
,
opts
),
dest
)
rb
=
other
.
listkeys
(
'
bookmarks
'
)
for
b
in
opts
[
'
bookmark
'
]:
# explicit push overrides remote bookmark if any
if
b
in
repo
.
_bookmarks
:
ui
.
status
(
_
(
"
exporting bookmark %s
\n
"
)
%
b
)
new
=
repo
[
b
].
hex
()
else
:
ui
.
status
(
_
(
"
deleting remote bookmark %s
\n
"
)
%
b
)
new
=
''
# delete
old
=
rb
.
get
(
b
,
''
)
r
=
other
.
pushkey
(
'
bookmarks
'
,
b
,
old
,
new
)
if
not
r
:
ui
.
warn
(
_
(
'
updating bookmark %s failed!
\n
'
)
%
b
)
if
not
result
:
result
=
2
return
result
def
uisetup
(
ui
):
extensions
.
wrapfunction
(
repair
,
"
strip
"
,
strip
)
if
ui
.
configbool
(
'
bookmarks
'
,
'
track.current
'
):
...
...
@@ -417,6 +453,9 @@
entry
=
extensions
.
wrapcommand
(
commands
.
table
,
'
pull
'
,
pull
)
entry
[
1
].
append
((
'
B
'
,
'
bookmark
'
,
[],
_
(
"
bookmark to import
"
)))
entry
=
extensions
.
wrapcommand
(
commands
.
table
,
'
push
'
,
push
)
entry
[
1
].
append
((
'
B
'
,
'
bookmark
'
,
[],
_
(
"
bookmark to export
"
)))
pushkey
.
register
(
'
bookmarks
'
,
pushbookmark
,
listbookmarks
)
...
...
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