[PATCH 3 of 3 V2] shelve: support sharing of shelves when using a shared repository

Yuya Nishihara yuya at tcha.org
Thu Apr 14 12:12:23 EDT 2016


On Thu, 14 Apr 2016 06:53:05 +0000, Oleg Afanasyev wrote:
> On 12/04/2016 14:44, "Yuya Nishihara" <youjah at gmail.com on behalf of yuya at tcha.org> wrote:
> >On Sat, 9 Apr 2016 10:34:10 -0700, Oleg Afanasyev wrote:  
> >> # HG changeset patch
> >> # User Oleg Afanasyev <olegaf at fb.com>
> >> # Date 1460186357 25200
> >> #      Sat Apr 09 00:19:17 2016 -0700
> >> # Node ID 2ff1d244b437194883fc1b7fea956a8712f34e39
> >> # Parent  3794055fbea2c129666292fb69df6c980fd886fb
> >> shelve: support sharing of shelves when using a shared repository  
> >
> >Looks like this should be marked as BC (behavior change) as the sharing
> >is not optional.

The shelve directory will be switched, which means a user who has shelved
changes against shared repository will no longer see these changes.

Is that okay?

> >> @@ -409,7 +409,7 @@
> >>      """subcommand that deletes all shelves"""
> >>  
> >>      with repo.wlock():
> >> -        for (name, _type) in repo.vfs.readdir(shelvedir):
> >> +        for (name, _type) in repo.sharedvfs().readdir(shelvedir):
> >>              suffix = name.rsplit('.', 1)[-1]
> >>              if suffix in ('hg', 'patch'):
> >>                  shelvedfile(repo, name).movetobackup()  
> >
> >Is the "shared" shelvedir is covered by wlock? I suspect it would need
> >sharedwlock or something.  
> 
> If we decide to introduce the new lock then it has to be used throughout
> and might need to go as third type of lock with all the ordering problems.
> On the other hand I think using existing wlock is safe on the other hand.
> It would not be worse that what we have now repositories will be coupled
> (e.g. we get wlock on shared even if we work on local .hg dir), but they
> are coupled on the store anyway.

Since deletecmd() doesn't touch the store, let's forget about repo.lock()
(= store lock).

Before, repo.wlock() took local .hg/wlock and deletecmd() modified local
.hg/shelved tree. That's fine. But with this patch, deletecmd() modifies
shared .hg/shelved tree without taking shared .hg/wlock, which seems wrong.


More information about the Mercurial-devel mailing list