Deleting bookmarks on the server
Stephen Lee
sphen.lee at gmail.com
Mon Apr 29 03:54:45 UTC 2013
On Mon, Apr 29, 2013 at 1:24 PM, Kevin Bullock
<kbullock+mercurial at ringworld.org> wrote:
>
> On 27 Apr 2013, at 10:42 PM, Stephen Lee wrote:
>
> > Hi All,
> >
> > I'm planning to write an extension that will allow bookmarks to be deleted on a server
>
> You know that you can delete bookmarks on a remote with push -B, right?
Yes I did know that, the problem is that there is no way to delete the
bookmark from local clones when they run pull.
This is what my extension is hoping to do.
Obviously we can;t delete bookmarks which are not present of the
server because they could be new, local bookmarks. Instead I want the
server to tell the client about bookmarks that it used to know, but
have been removed.
>
> > and have the deletion shared with clients.
> > This would work by setting the bookmark to point to null, and filtering these from the UI. This is similar to the way non-local tag deletion works.
> > I can see two problems with this:
> > * it would not be possible to bookmark null which is a minor annoyance when creating the @ bookmark on an empty repo
> > * deleting a bookmark from the server that has been moved on the client cannot be detected as a divergence
>
> The main problem here is that bookmarks have no history (by design), so there's really no way you can design a sensical distributed synchronization protocol for them.
Are you implying the current synchronisation protocol is nonsensical? :P
I guess I'm imagining a special node, which rather than being the root
of every branch (like null) is considered a child of every branch.
Moving a bookmark to this special node would hide it from the UI as
though it had been deleted. It would be synced just like a normal
bookmark and this node would be a valid dest from any other node.
Perhaps if another SHA1 sum was reserved like 'FF' * 20 it could be
used for this special node.
Hence there would be two kinds of delete: the current one which means
"stop tracking this bookmark", and the new delete which means "tell
all clients that this bookmark is not needed anymore" (UI implications
of this TBD...)
>
> > The reason I want this behaviour is that we are using bookmarks to track developer's work-in-progress in the 'awaiting review' repo on the server - but once the code has passed review and is merged into the baseline the bookmark is not needed. We could just leave them, but deleting them makes it easier to see what still needs reviewing.
>
> This is really where revsets shine: hg log -r 'bookmark() - ::mainline'
That is a good revset, I hadn't thought of using the bookmark
predicate like that. I am currently suggesting people use "not ::@"
which is a bit less precise.
My real problem however is with the bookmark command itself, and with
the web server.
"hg bookmark" cannot be made to show a subset of bookmarks using revsets.
"hg log --template '{bookmarks}\t{rev}:{node|short}\n' -r 'bookmark()
- ::@' " could be setup as an alias which does pretty much what I
want.
But this still leaves the web server cluttered with all the old
bookmarks - however since I control that repo I can ensure they are
deleted when merging.
Local clones can hide them using the revset above, or periodically
delete them with a script.
I'm going to sit and think on this - it might be possible to fix this
without an extension.
Thanks again for your insights Kevin.
Steve
>
> pacem in terris / мир / शान्ति / سَلاَم / 平和
> Kevin R. Bullock
>
More information about the Mercurial
mailing list