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
cb21fb1b
Commit
cb21fb1b
authored
14 years ago
by
Matt Mackall
Browse files
Options
Downloads
Patches
Plain Diff
bookmarks: add support for pull --bookmark to import remote bookmarks
parent
9916263d
Loading
Loading
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
hgext/bookmarks.py
+32
-1
32 additions, 1 deletion
hgext/bookmarks.py
with
32 additions
and
1 deletion
hgext/bookmarks.py
+
32
−
1
View file @
cb21fb1b
...
...
@@ -30,7 +30,7 @@
from
mercurial.i18n
import
_
from
mercurial.node
import
nullid
,
nullrev
,
hex
,
short
from
mercurial
import
util
,
commands
,
repair
,
extensions
,
pushkey
from
mercurial
import
util
,
commands
,
repair
,
extensions
,
pushkey
,
hg
import
os
def
write
(
repo
):
...
...
@@ -383,7 +383,33 @@
finally
:
w
.
release
()
def
pull
(
oldpull
,
ui
,
repo
,
source
=
"
default
"
,
**
opts
):
# translate bookmark args to rev args for actual pull
if
opts
.
get
(
'
bookmark
'
):
# this is an unpleasant hack as pull will do this internally
source
,
branches
=
hg
.
parseurl
(
ui
.
expandpath
(
source
),
opts
.
get
(
'
branch
'
))
other
=
hg
.
repository
(
hg
.
remoteui
(
repo
,
opts
),
source
)
rb
=
other
.
listkeys
(
'
bookmarks
'
)
for
b
in
opts
[
'
bookmark
'
]:
if
b
not
in
rb
:
raise
util
.
Abort
(
_
(
'
remote bookmark %s not found!
'
)
%
b
)
opts
.
setdefault
(
'
rev
'
,
[]).
append
(
b
)
result
=
oldpull
(
ui
,
repo
,
source
,
**
opts
)
# update specified bookmarks
if
opts
.
get
(
'
bookmark
'
):
for
b
in
opts
[
'
bookmark
'
]:
# explicit pull overrides local bookmark if any
ui
.
status
(
_
(
"
importing bookmark %s
\n
"
)
%
b
)
repo
.
_bookmarks
[
b
]
=
repo
[
rb
[
b
]].
node
()
write
(
repo
)
return
result
def
uisetup
(
ui
):
extensions
.
wrapfunction
(
repair
,
"
strip
"
,
strip
)
if
ui
.
configbool
(
'
bookmarks
'
,
'
track.current
'
):
extensions
.
wrapcommand
(
commands
.
table
,
'
update
'
,
updatecurbookmark
)
...
...
@@ -386,7 +412,12 @@
def
uisetup
(
ui
):
extensions
.
wrapfunction
(
repair
,
"
strip
"
,
strip
)
if
ui
.
configbool
(
'
bookmarks
'
,
'
track.current
'
):
extensions
.
wrapcommand
(
commands
.
table
,
'
update
'
,
updatecurbookmark
)
entry
=
extensions
.
wrapcommand
(
commands
.
table
,
'
pull
'
,
pull
)
entry
[
1
].
append
((
'
B
'
,
'
bookmark
'
,
[],
_
(
"
bookmark to import
"
)))
pushkey
.
register
(
'
bookmarks
'
,
pushbookmark
,
listbookmarks
)
def
updatecurbookmark
(
orig
,
ui
,
repo
,
*
args
,
**
opts
):
...
...
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