Show More
@@ -15,14 +15,15 b' command = cmdutil.command(cmdtable)' | |||||
15 | testedwith = 'internal' |
|
15 | testedwith = 'internal' | |
16 |
|
16 | |||
17 | @command('share', |
|
17 | @command('share', | |
18 |
[('U', 'noupdate', None, _('do not create a working copy')) |
|
18 | [('U', 'noupdate', None, _('do not create a working copy')), | |
19 | _('[-U] SOURCE [DEST]'), |
|
19 | ('B', 'bookmarks', None, _('also share bookmarks'))], | |
|
20 | _('[-U] [-B] SOURCE [DEST]'), | |||
20 | norepo=True) |
|
21 | norepo=True) | |
21 | def share(ui, source, dest=None, noupdate=False): |
|
22 | def share(ui, source, dest=None, noupdate=False, bookmarks=False): | |
22 | """create a new shared repository |
|
23 | """create a new shared repository | |
23 |
|
24 | |||
24 | Initialize a new repository and working directory that shares its |
|
25 | Initialize a new repository and working directory that shares its | |
25 | history with another repository. |
|
26 | history (and optionally bookmarks) with another repository. | |
26 |
|
27 | |||
27 | .. note:: |
|
28 | .. note:: | |
28 |
|
29 | |||
@@ -36,7 +37,7 b' def share(ui, source, dest=None, noupdat' | |||||
36 | the broken clone to reset it to a changeset that still exists. |
|
37 | the broken clone to reset it to a changeset that still exists. | |
37 | """ |
|
38 | """ | |
38 |
|
39 | |||
39 | return hg.share(ui, source, dest, not noupdate) |
|
40 | return hg.share(ui, source, dest, not noupdate, bookmarks) | |
40 |
|
41 | |||
41 | @command('unshare', [], '') |
|
42 | @command('unshare', [], '') | |
42 | def unshare(ui, repo): |
|
43 | def unshare(ui, repo): |
@@ -158,7 +158,7 b' def defaultdest(source):' | |||||
158 | return '' |
|
158 | return '' | |
159 | return os.path.basename(os.path.normpath(path)) |
|
159 | return os.path.basename(os.path.normpath(path)) | |
160 |
|
160 | |||
161 | def share(ui, source, dest=None, update=True): |
|
161 | def share(ui, source, dest=None, update=True, bookmarks=True): | |
162 | '''create a shared repository''' |
|
162 | '''create a shared repository''' | |
163 |
|
163 | |||
164 | if not islocal(source): |
|
164 | if not islocal(source): | |
@@ -225,6 +225,9 b' def share(ui, source, dest=None, update=' | |||||
225 | continue |
|
225 | continue | |
226 | _update(r, uprev) |
|
226 | _update(r, uprev) | |
227 |
|
227 | |||
|
228 | if bookmarks: | |||
|
229 | r.opener('bookmarks.shared', 'w').close() | |||
|
230 | ||||
228 | def copystore(ui, srcrepo, destpath): |
|
231 | def copystore(ui, srcrepo, destpath): | |
229 | '''copy files from store of srcrepo in destpath |
|
232 | '''copy files from store of srcrepo in destpath | |
230 |
|
233 |
@@ -129,9 +129,9 b' check that a change does not propagate' | |||||
129 | $ cd .. |
|
129 | $ cd .. | |
130 |
|
130 | |||
131 |
|
131 | |||
132 | test sharing bookmarks (manually add bookmarks.shared file for now) |
|
132 | test sharing bookmarks | |
133 |
|
133 | |||
134 | $ hg share repo1 repo3 && touch repo3/.hg/bookmarks.shared |
|
134 | $ hg share -B repo1 repo3 | |
135 | updating working directory |
|
135 | updating working directory | |
136 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
136 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
137 | $ cd repo1 |
|
137 | $ cd repo1 | |
@@ -212,7 +212,7 b' test pushing bookmarks works' | |||||
212 |
|
212 | |||
213 | test behavior when sharing a shared repo |
|
213 | test behavior when sharing a shared repo | |
214 |
|
214 | |||
215 | $ hg share repo3 repo5 && touch repo5/.hg/bookmarks.shared |
|
215 | $ hg share -B repo3 repo5 | |
216 | updating working directory |
|
216 | updating working directory | |
217 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
217 | 2 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
218 | $ cd repo5 |
|
218 | $ cd repo5 |
General Comments 0
You need to be logged in to leave comments.
Login now