thoughts on dictionary extension mechanism to wire protocol
Bill Barry
after.fallout at gmail.com
Sat Jan 24 16:14:25 CST 2009
acl
---
An acl could be defined in hgrc like so:
[incoming]
bookmarks=repo1url
bookmarks=repo2url
[outgoing]
bookmarks=repo3url
or you could do persons and you could push and pull to repositories
owned by that person (if you don't have any 'bookmarks' keys it would
allow all)
If you have a repository /repo with that hgrc then:
at /repo:
hg pull repo1url would update the bookmarks key
hg pull repo2url would update the bookmarks key
hg pull repo3url would not update the bookmarks key (merge algorithm
would be internal:local)
hg push repo1url would not attempt to update the repo1 bookmarks key
hg push repo3url would attempt to update the repo3 bookmarks key
if you have a destination repository that you push/pull with, and that
repo has that hgrc:
at repo1url:
hg push would update the bookmarks key
hg pull would not update the bookmarks key
dictionary with bookmarks example
------------------------------------
directory: .hg/dictionary
file inside: bookmarks
in the extension you would have to define a key-value pair to handle
merging of the file automatically (the key being either a file or folder
named right in the root of the dictionary folder, value would be a a
method pair, one for a merge algorithm during pull and one for push):
dictionary = [
'bookmarks' : (bookmarkpullmerge, bookmarkpushmerge)
]
def bookmarkpushmerge(local, foreign):
'the bookmark with the highest revision number wins -- if the
bookmark is only on one side it is kept'
def bookmarkpullmerge(local, foreign):
'if sect['merge']['bookmarks'] then interactively merge?, else
follow push algorithm'
The dictionary folder would have a full DAG associated with it with one
revision created before each remote operation (ex pull or push).
When pulling and pushing, all new nodes would get into the destination
and a merge algorithm would be run to merge back to a single tip:
if command run is 'hg push' then the destination (the server) will run
the bookmarkpushmerge method
if the command run is 'hg pull' then the destination (the local copy)
will run the bookmarkpullmerge method
More information about the Mercurial-devel
mailing list