[PATCH] bookmarks: pull new bookmarks from remote by default
Levi Bard
taktaktaktaktaktaktaktaktaktak at gmail.com
Sat May 12 08:42:55 CDT 2012
# HG changeset patch
# User Levi Bard <levi at unity3d.com>
# Date 1336829914 -7200
# Node ID fde0b4607778d938c772c08b17ce6febb784aee4
# Parent 76c744e0c5bbd0900beba49787b7e04ba862939b
bookmarks: pull new bookmarks from remote by default
diff -r 76c744e0c5bb -r fde0b4607778 mercurial/bookmarks.py
--- a/mercurial/bookmarks.py Sat May 12 13:20:26 2012 +0200
+++ b/mercurial/bookmarks.py Sat May 12 15:38:34 2012 +0200
@@ -190,7 +190,7 @@
finally:
w.release()
-def updatefromremote(ui, repo, remote, path):
+def updatefromremote(ui, repo, remote, path, updateunknown):
ui.debug("checking for updated bookmarks\n")
rb = remote.listkeys('bookmarks')
changed = False
@@ -221,6 +221,10 @@
repo._bookmarks[n] = cr.node()
changed = True
ui.warn(_("divergent bookmark %s stored as %s\n") % (k, n))
+ elif updateunknown and rb[k] in repo:
+ repo._bookmarks[k] = rb[k]
+ changed = True
+ ui.status(_("adding remote bookmark %s\n") % k)
if changed:
write(repo)
diff -r 76c744e0c5bb -r fde0b4607778 mercurial/commands.py
--- a/mercurial/commands.py Sat May 12 13:20:26 2012 +0200
+++ b/mercurial/commands.py Sat May 12 15:38:34 2012 +0200
@@ -4492,7 +4492,8 @@
raise util.Abort(err)
modheads = repo.pull(other, heads=revs, force=opts.get('force'))
- bookmarks.updatefromremote(ui, repo, other, source)
+ bookmarks.updatefromremote(ui, repo, other, source,
+ updateunknown=not opts.get('bookmark'))
if checkout:
checkout = str(repo.changelog.rev(other.lookup(checkout)))
repo._subtoppath = source
diff -r 76c744e0c5bb -r fde0b4607778 mercurial/subrepo.py
--- a/mercurial/subrepo.py Sat May 12 13:20:26 2012 +0200
+++ b/mercurial/subrepo.py Sat May 12 15:38:34 2012 +0200
@@ -506,7 +506,7 @@
% (subrelpath(self), srcurl))
self._repo.pull(other)
bookmarks.updatefromremote(self._repo.ui, self._repo, other,
- srcurl)
+ srcurl, updateunknown=True)
def get(self, state, overwrite=False):
self._get(state)
diff -r 76c744e0c5bb -r fde0b4607778 tests/test-bookmarks-pushpull.t
--- a/tests/test-bookmarks-pushpull.t Sat May 12 13:20:26 2012 +0200
+++ b/tests/test-bookmarks-pushpull.t Sat May 12 15:38:34 2012 +0200
@@ -29,6 +29,8 @@
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
Y 0:4e3505fd9583
@@ -122,6 +124,7 @@
adding file changes
added 1 changesets with 1 changes to 1 files (+1 heads)
divergent bookmark X stored as X at foo
+ adding remote bookmark Z
(run 'hg heads' to see heads, 'hg merge' to merge)
$ hg book
* X 1:9b140be10808
@@ -159,9 +162,9 @@
namespaces
$ hg debugpushkey http://localhost:$HGPORT/ bookmarks
Y 4e3505fd95835d721066b76e75dbb8cc554d7f77
+ foobar 9b140be1080824d768c5a4691a564088eede71f9
+ foo 0000000000000000000000000000000000000000
X 9b140be1080824d768c5a4691a564088eede71f9
- foo 0000000000000000000000000000000000000000
- foobar 9b140be1080824d768c5a4691a564088eede71f9
$ hg out -B http://localhost:$HGPORT/
comparing with http://localhost:$HGPORT/
searching for changed bookmarks
diff -r 76c744e0c5bb -r fde0b4607778 tests/test-hook.t
--- a/tests/test-hook.t Sat May 12 13:20:26 2012 +0200
+++ b/tests/test-hook.t Sat May 12 15:38:34 2012 +0200
@@ -279,6 +279,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 +448,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
More information about the Mercurial-devel
mailing list