Submitter | Angel Ezquerra |
---|---|
Date | Jan. 16, 2015, 7:35 a.m. |
Message ID | <5d4b4f363616487a9a5e.1421393734@Angels-MacBook-Pro.local> |
Download | mbox | patch |
Permalink | /patch/7488/ |
State | Accepted |
Headers | show |
Comments
On Jan 15, 2015, at 23:35, Angel Ezquerra <angel.ezquerra@gmail.com> wrote: > > # HG changeset patch > # User Angel Ezquerra <angel.ezquerra@gmail.com> > # Date 1420989615 -3600 > # Sun Jan 11 16:20:15 2015 +0100 > # Node ID 5d4b4f363616487a9a5eb6c2a31ffd80f787818e > # Parent dc6d8a8243f3096d6eb2800ef18f300a2d9d54e1 > share: replace the bookmarks.shared file with an entry on a new "shared" 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 "shared" file that will list > what is shared for a given shared repository. This should make it much easier > to get a list of everything that is shared by a given shared repository. > > The shared file contains a list of shared "items" (such as bookmarks). Each > shared "item" is added as a new line in the file. For now the only possible > entry in the file is "bookmarks". > > diff --git a/hgext/share.py b/hgext/share.py > --- a/hgext/share.py > +++ b/hgext/share.py > @@ -79,12 +79,12 @@ > def _hassharedbookmarks(repo): > """Returns whether this repo has shared bookmarks""" > try: > - repo.vfs.read('bookmarks.shared') > - return True > + shared = repo.vfs.read('shared').splitlines() > except IOError, inst: > if inst.errno != errno.ENOENT: > raise > return False > + return 'bookmarks' in shared > > def _getsrcrepo(repo): > """ > diff --git a/mercurial/hg.py b/mercurial/hg.py > --- a/mercurial/hg.py > +++ b/mercurial/hg.py > @@ -226,7 +226,9 @@ > _update(r, uprev) > > if bookmarks: > - r.vfs('bookmarks.shared', 'w').close() > + fp = r.vfs('shared', 'w') > + fp.write('bookmarks\n') > + fp.close() > > def copystore(ui, srcrepo, destpath): > '''copy files from store of srcrepo in destpath > +1 Do you have plans to write a proper, content-preserving implementation before freeze?
On 1/16/2015 12:02 AM, Gregory Szorc wrote: > On Jan 15, 2015, at 23:35, Angel Ezquerra <angel.ezquerra@gmail.com> wrote: >> # HG changeset patch >> # User Angel Ezquerra <angel.ezquerra@gmail.com> >> # Date 1420989615 -3600 >> # Sun Jan 11 16:20:15 2015 +0100 >> # Node ID 5d4b4f363616487a9a5eb6c2a31ffd80f787818e >> # Parent dc6d8a8243f3096d6eb2800ef18f300a2d9d54e1 >> share: replace the bookmarks.shared file with an entry on a new "shared" 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 "shared" file that will list >> what is shared for a given shared repository. This should make it much easier >> to get a list of everything that is shared by a given shared repository. >> >> The shared file contains a list of shared "items" (such as bookmarks). Each >> shared "item" is added as a new line in the file. For now the only possible >> entry in the file is "bookmarks". >> >> diff --git a/hgext/share.py b/hgext/share.py >> --- a/hgext/share.py >> +++ b/hgext/share.py >> @@ -79,12 +79,12 @@ >> def _hassharedbookmarks(repo): >> """Returns whether this repo has shared bookmarks""" >> try: >> - repo.vfs.read('bookmarks.shared') >> - return True >> + shared = repo.vfs.read('shared').splitlines() >> except IOError, inst: >> if inst.errno != errno.ENOENT: >> raise >> return False >> + return 'bookmarks' in shared >> >> def _getsrcrepo(repo): >> """ >> diff --git a/mercurial/hg.py b/mercurial/hg.py >> --- a/mercurial/hg.py >> +++ b/mercurial/hg.py >> @@ -226,7 +226,9 @@ >> _update(r, uprev) >> >> if bookmarks: >> - r.vfs('bookmarks.shared', 'w').close() >> + fp = r.vfs('shared', 'w') >> + fp.write('bookmarks\n') >> + fp.close() >> >> def copystore(ui, srcrepo, destpath): >> '''copy files from store of srcrepo in destpath >> > +1 > > Do you have plans to write a proper, content-preserving implementation before freeze? > Patch looks good to me too. It's far more important to get the basic structure set up before freeze; since this file is written only at share time, I don't think content preservation is necessary before freeze (or maybe ever, unless gradual/progessive sharing is introduced at some point?)
On Fri, Jan 16, 2015 at 9:17 AM, Ryan McElroy <rm@fb.com> wrote: > > On 1/16/2015 12:02 AM, Gregory Szorc wrote: >> >> On Jan 15, 2015, at 23:35, Angel Ezquerra <angel.ezquerra@gmail.com> >> wrote: >>> >>> # HG changeset patch >>> # User Angel Ezquerra <angel.ezquerra@gmail.com> >>> # Date 1420989615 -3600 >>> # Sun Jan 11 16:20:15 2015 +0100 >>> # Node ID 5d4b4f363616487a9a5eb6c2a31ffd80f787818e >>> # Parent dc6d8a8243f3096d6eb2800ef18f300a2d9d54e1 >>> share: replace the bookmarks.shared file with an entry on a new "shared" >>> 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 "shared" file that will >>> list >>> what is shared for a given shared repository. This should make it much >>> easier >>> to get a list of everything that is shared by a given shared repository. >>> >>> The shared file contains a list of shared "items" (such as bookmarks). >>> Each >>> shared "item" is added as a new line in the file. For now the only >>> possible >>> entry in the file is "bookmarks". >>> >>> diff --git a/hgext/share.py b/hgext/share.py >>> --- a/hgext/share.py >>> +++ b/hgext/share.py >>> @@ -79,12 +79,12 @@ >>> def _hassharedbookmarks(repo): >>> """Returns whether this repo has shared bookmarks""" >>> try: >>> - repo.vfs.read('bookmarks.shared') >>> - return True >>> + shared = repo.vfs.read('shared').splitlines() >>> except IOError, inst: >>> if inst.errno != errno.ENOENT: >>> raise >>> return False >>> + return 'bookmarks' in shared >>> >>> def _getsrcrepo(repo): >>> """ >>> diff --git a/mercurial/hg.py b/mercurial/hg.py >>> --- a/mercurial/hg.py >>> +++ b/mercurial/hg.py >>> @@ -226,7 +226,9 @@ >>> _update(r, uprev) >>> >>> if bookmarks: >>> - r.vfs('bookmarks.shared', 'w').close() >>> + fp = r.vfs('shared', 'w') >>> + fp.write('bookmarks\n') >>> + fp.close() >>> >>> def copystore(ui, srcrepo, destpath): >>> '''copy files from store of srcrepo in destpath >>> >> +1 >> >> Do you have plans to write a proper, content-preserving implementation >> before freeze? >> > Patch looks good to me too. > > It's far more important to get the basic structure set up before freeze; > since this file is written only at share time, I don't think content > preservation is necessary before freeze (or maybe ever, unless > gradual/progessive sharing is introduced at some point?) Yes, those were exactly my thoughts. Cheers, Angel
On 01/16/2015 12:17 AM, Ryan McElroy wrote: > > On 1/16/2015 12:02 AM, Gregory Szorc wrote: >> On Jan 15, 2015, at 23:35, Angel Ezquerra <angel.ezquerra@gmail.com> >> wrote: >>> # HG changeset patch >>> # User Angel Ezquerra <angel.ezquerra@gmail.com> >>> # Date 1420989615 -3600 >>> # Sun Jan 11 16:20:15 2015 +0100 >>> # Node ID 5d4b4f363616487a9a5eb6c2a31ffd80f787818e >>> # Parent dc6d8a8243f3096d6eb2800ef18f300a2d9d54e1 >>> share: replace the bookmarks.shared file with an entry on a new >>> "shared" 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 "shared" file that >>> will list >>> what is shared for a given shared repository. This should make it >>> much easier >>> to get a list of everything that is shared by a given shared repository. >>> >>> The shared file contains a list of shared "items" (such as >>> bookmarks). Each >>> shared "item" is added as a new line in the file. For now the only >>> possible >>> entry in the file is "bookmarks". >>> >>> diff --git a/hgext/share.py b/hgext/share.py >>> --- a/hgext/share.py >>> +++ b/hgext/share.py >>> @@ -79,12 +79,12 @@ >>> def _hassharedbookmarks(repo): >>> """Returns whether this repo has shared bookmarks""" >>> try: >>> - repo.vfs.read('bookmarks.shared') >>> - return True >>> + shared = repo.vfs.read('shared').splitlines() >>> except IOError, inst: >>> if inst.errno != errno.ENOENT: >>> raise >>> return False >>> + return 'bookmarks' in shared >>> >>> def _getsrcrepo(repo): >>> """ >>> diff --git a/mercurial/hg.py b/mercurial/hg.py >>> --- a/mercurial/hg.py >>> +++ b/mercurial/hg.py >>> @@ -226,7 +226,9 @@ >>> _update(r, uprev) >>> >>> if bookmarks: >>> - r.vfs('bookmarks.shared', 'w').close() >>> + fp = r.vfs('shared', 'w') >>> + fp.write('bookmarks\n') >>> + fp.close() >>> >>> def copystore(ui, srcrepo, destpath): >>> '''copy files from store of srcrepo in destpath >>> >> +1 >> >> Do you have plans to write a proper, content-preserving implementation >> before freeze? >> > Patch looks good to me too. And has been pushed to the clowncopter > It's far more important to get the basic structure set up before freeze; > since this file is written only at share time, I don't think content > preservation is necessary before freeze (or maybe ever, unless > gradual/progessive sharing is introduced at some point?) +1 the very important part is to not have to change the file format in later version.
On Fri, Jan 16, 2015 at 08:35:34AM +0100, Angel Ezquerra wrote: > # HG changeset patch > # User Angel Ezquerra <angel.ezquerra@gmail.com> > # Date 1420989615 -3600 > # Sun Jan 11 16:20:15 2015 +0100 > # Node ID 5d4b4f363616487a9a5eb6c2a31ffd80f787818e > # Parent dc6d8a8243f3096d6eb2800ef18f300a2d9d54e1 > share: replace the bookmarks.shared file with an entry on a new "shared" file For those following along on the list, this was pushed as 7e71898a7cdc. > > 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 "shared" file that will list > what is shared for a given shared repository. This should make it much easier > to get a list of everything that is shared by a given shared repository. > > The shared file contains a list of shared "items" (such as bookmarks). Each > shared "item" is added as a new line in the file. For now the only possible > entry in the file is "bookmarks". > > diff --git a/hgext/share.py b/hgext/share.py > --- a/hgext/share.py > +++ b/hgext/share.py > @@ -79,12 +79,12 @@ > def _hassharedbookmarks(repo): > """Returns whether this repo has shared bookmarks""" > try: > - repo.vfs.read('bookmarks.shared') > - return True > + shared = repo.vfs.read('shared').splitlines() > except IOError, inst: > if inst.errno != errno.ENOENT: > raise > return False > + return 'bookmarks' in shared > > def _getsrcrepo(repo): > """ > diff --git a/mercurial/hg.py b/mercurial/hg.py > --- a/mercurial/hg.py > +++ b/mercurial/hg.py > @@ -226,7 +226,9 @@ > _update(r, uprev) > > if bookmarks: > - r.vfs('bookmarks.shared', 'w').close() > + fp = r.vfs('shared', 'w') > + fp.write('bookmarks\n') > + fp.close() > > def copystore(ui, srcrepo, destpath): > '''copy files from store of srcrepo in destpath > _______________________________________________ > Mercurial-devel mailing list > Mercurial-devel@selenic.com > http://selenic.com/mailman/listinfo/mercurial-devel
Patch
diff --git a/hgext/share.py b/hgext/share.py --- a/hgext/share.py +++ b/hgext/share.py @@ -79,12 +79,12 @@ def _hassharedbookmarks(repo): """Returns whether this repo has shared bookmarks""" try: - repo.vfs.read('bookmarks.shared') - return True + shared = repo.vfs.read('shared').splitlines() except IOError, inst: if inst.errno != errno.ENOENT: raise return False + return 'bookmarks' in shared def _getsrcrepo(repo): """ diff --git a/mercurial/hg.py b/mercurial/hg.py --- a/mercurial/hg.py +++ b/mercurial/hg.py @@ -226,7 +226,9 @@ _update(r, uprev) if bookmarks: - r.vfs('bookmarks.shared', 'w').close() + fp = r.vfs('shared', 'w') + fp.write('bookmarks\n') + fp.close() def copystore(ui, srcrepo, destpath): '''copy files from store of srcrepo in destpath