merge with stable
authorMatt Mackall <mpm@selenic.com>
Thu, 12 Nov 2015 15:26:30 -0600
changeset 26934 2fb17f60bffa
parent 26932 eb49ffa39fe2 (current diff)
parent 26933 a7eecd021782 (diff)
child 26935 c4a7bbc78c74
merge with stable
tests/test-shelve.t
--- a/hgext/share.py	Sat Nov 07 13:48:42 2015 -0500
+++ b/hgext/share.py	Thu Nov 12 15:26:30 2015 -0600
@@ -123,7 +123,7 @@
 def extsetup(ui):
     extensions.wrapfunction(bookmarks.bmstore, 'getbkfile', getbkfile)
     extensions.wrapfunction(bookmarks.bmstore, 'recordchange', recordchange)
-    extensions.wrapfunction(bookmarks.bmstore, 'write', write)
+    extensions.wrapfunction(bookmarks.bmstore, '_writerepo', writerepo)
     extensions.wrapcommand(commands.table, 'clone', clone)
 
 def _hassharedbookmarks(repo):
@@ -166,10 +166,11 @@
             category = 'share-bookmarks'
             tr.addpostclose(category, lambda tr: self._writerepo(srcrepo))
 
-def write(orig, self):
+def writerepo(orig, self, repo):
     # First write local bookmarks file in case we ever unshare
-    orig(self)
+    orig(self, repo)
+
     if _hassharedbookmarks(self._repo):
         srcrepo = _getsrcrepo(self._repo)
         if srcrepo is not None:
-            self._writerepo(srcrepo)
+            orig(self, srcrepo)
--- a/tests/test-shelve.t	Sat Nov 07 13:48:42 2015 -0500
+++ b/tests/test-shelve.t	Thu Nov 12 15:26:30 2015 -0600
@@ -1174,3 +1174,42 @@
   rebase aborted
   $ hg up -C .
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ cd ..
+
+Keep active bookmark while (un)shelving even on shared repo (issue4940)
+-----------------------------------------------------------------------
+
+  $ cat <<EOF >> $HGRCPATH
+  > [extensions]
+  > share =
+  > EOF
+
+  $ hg bookmarks -R repo
+     test                      4:33f7f61e6c5e
+  $ hg share -B repo share
+  updating working directory
+  6 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd share
+
+  $ hg bookmarks
+     test                      4:33f7f61e6c5e
+  $ hg bookmarks foo
+  $ hg bookmarks
+   * foo                       5:703117a2acfb
+     test                      4:33f7f61e6c5e
+  $ echo x >> x
+  $ hg shelve
+  shelved as foo
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg bookmarks
+   * foo                       5:703117a2acfb
+     test                      4:33f7f61e6c5e
+
+  $ hg unshelve
+  unshelving change 'foo'
+  $ hg bookmarks
+   * foo                       5:703117a2acfb
+     test                      4:33f7f61e6c5e
+
+  $ cd ..