[PATCH] share: replace the bookmarks.shared file with an entry on a new shared.conf file
angel.ezquerra at gmail.com
Sun Jan 11 09:23:42 CST 2015
# HG changeset patch
# User Angel Ezquerra <angel.ezquerra at gmail.com>
# Date 1420989615 -3600
# Sun Jan 11 16:20:15 2015 +0100
# Node ID 8eca5c61ad384fdd4640ff6ef0c51062d3171878
# Parent 678f53865c6860a950392691814766957ee89316
share: replace the bookmarks.shared file with an entry on a new shared.conf file
cd79fb4d75fd introduced a way to share bookmarks. When a repository share that
shares bookmarks was created, a .hg/bookmarks.shared file was created to mark
the repository share as one that shares its bookmarks.
We have plans to introduce other levels of sharing, including a "full share"
mode. Rather than creating a new ".shared" file for each new thing that we may
want to share It seems better to create a single share.conf file that will list
what is shared for a given file. This should make it much easier to get a list
of everything that is shared by a given shared repository.
The shared file is a config file that can be read with mercurial's config
module. I've decided against calling the config file "sharerc" to emphasize the
fact that this file is not meant to be edited by users. Each shared "item" is
added as an entry in the "share" section of the share.conf file. For now the
only possible entry in that section is "bookmarks".
diff --git a/hgext/share.py b/hgext/share.py
@@ -6,7 +6,7 @@
'''share a common history between several working directories'''
from mercurial.i18n import _
-from mercurial import cmdutil, hg, util, extensions, bookmarks
+from mercurial import cmdutil, hg, util, extensions, bookmarks, config
from mercurial.hg import repository, parseurl
@@ -78,13 +78,11 @@
"""Returns whether this repo has shared bookmarks"""
- return True
- except IOError, inst:
- if inst.errno != errno.ENOENT:
+ if not repo.vfs.exists('share.conf'):
+ cfg = config.config()
+ return cfg.get('share', 'bookmarks', None) is not None
diff --git a/mercurial/hg.py b/mercurial/hg.py
@@ -226,7 +226,9 @@
- r.opener('bookmarks.shared', 'w').close()
+ fp = r.opener('share.conf', 'w')
def copystore(ui, srcrepo, destpath):
'''copy files from store of srcrepo in destpath
More information about the Mercurial-devel