--- a/mercurial/bookmarks.py Thu May 03 15:14:58 2012 +0200
+++ b/mercurial/bookmarks.py Sat May 12 17:00:01 2012 +0200
@@ -221,6 +221,11 @@
repo._bookmarks[n] = cr.node()
changed = True
ui.warn(_("divergent bookmark %s stored as %s\n") % (k, n))
+ elif rb[k] in repo:
+ # add remote bookmarks for changes we already have
+ repo._bookmarks[k] = repo[rb[k]].node()
+ changed = True
+ ui.status(_("adding remote bookmark %s\n") % k)
if changed:
write(repo)
--- a/tests/test-bookmarks-pushpull.t Thu May 03 15:14:58 2012 +0200
+++ b/tests/test-bookmarks-pushpull.t Sat May 12 17:00:01 2012 +0200
@@ -29,9 +29,13 @@
adding file changes
added 1 changesets with 1 changes to 1 files
updating bookmark Y
+ adding remote bookmark X
+ adding remote bookmark Z
(run 'hg update' to get a working copy)
$ hg bookmarks
+ X 0:4e3505fd9583
Y 0:4e3505fd9583
+ Z 0:4e3505fd9583
$ hg debugpushkey ../a namespaces
bookmarks
phases
@@ -47,6 +51,7 @@
$ hg bookmark
X 0:4e3505fd9583
Y 0:4e3505fd9583
+ Z 0:4e3505fd9583
export bookmark by name
@@ -111,6 +116,7 @@
$ hg book
* X 1:9b140be10808
Y 0:4e3505fd9583
+ Z 0:4e3505fd9583
foo -1:000000000000
foobar 1:9b140be10808
@@ -122,11 +128,13 @@
adding file changes
added 1 changesets with 1 changes to 1 files (+1 heads)
divergent bookmark X stored as X@foo
+ updating bookmark Z
(run 'hg heads' to see heads, 'hg merge' to merge)
$ hg book
* X 1:9b140be10808
X@foo 2:0d2164f0ce0d
Y 0:4e3505fd9583
+ Z 2:0d2164f0ce0d
foo -1:000000000000
foobar 1:9b140be10808
$ hg push -f ../a
@@ -159,13 +167,15 @@
namespaces
$ hg debugpushkey http://localhost:$HGPORT/ bookmarks
Y 4e3505fd95835d721066b76e75dbb8cc554d7f77
- X 9b140be1080824d768c5a4691a564088eede71f9
+ foobar 9b140be1080824d768c5a4691a564088eede71f9
+ Z 0d2164f0ce0d8f1d6f94351eba04b794909be66c
foo 0000000000000000000000000000000000000000
- foobar 9b140be1080824d768c5a4691a564088eede71f9
+ X 9b140be1080824d768c5a4691a564088eede71f9
$ hg out -B http://localhost:$HGPORT/
comparing with http://localhost:$HGPORT/
searching for changed bookmarks
- Z 0d2164f0ce0d
+ no changed bookmarks found
+ [1]
$ hg push -B Z http://localhost:$HGPORT/
pushing to http://localhost:$HGPORT/
searching for changes
@@ -182,6 +192,9 @@
$ hg pull -B Z http://localhost:$HGPORT/
pulling from http://localhost:$HGPORT/
no changes found
+ adding remote bookmark foobar
+ adding remote bookmark Z
+ adding remote bookmark foo
divergent bookmark X stored as X@1
importing bookmark Z
$ hg clone http://localhost:$HGPORT/ cloned-bookmarks
--- a/tests/test-hook.t Thu May 03 15:14:58 2012 +0200
+++ b/tests/test-hook.t Sat May 12 17:00:01 2012 +0200
@@ -195,6 +195,7 @@
no changes found
listkeys hook: HG_NAMESPACE=phases HG_VALUES={'cb9a9f314b8b07ba71012fcdbc544b5a4d82ff5b': '1', 'publishing': 'True'}
listkeys hook: HG_NAMESPACE=bookmarks HG_VALUES={'bar': '0000000000000000000000000000000000000000', 'foo': '0000000000000000000000000000000000000000'}
+ adding remote bookmark bar
importing bookmark bar
$ cd ../a
@@ -279,6 +280,7 @@
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
+ adding remote bookmark quux
(run 'hg update' to get a working copy)
$ hg rollback
repository tip rolled back to revision 3 (undo pull)
@@ -447,6 +449,7 @@
adding manifests
adding file changes
added 1 changesets with 1 changes to 1 files
+ adding remote bookmark quux
(run 'hg update' to get a working copy)
make sure --traceback works