Skip to content
Snippets Groups Projects
Commit 8e6649616699 authored by Pierre-Yves David's avatar Pierre-Yves David
Browse files

destupdate: have a generic and extensible way to run each step

We want extension to be able to easily override or add new way to select the
default update destination. We use the same list + dict approach as in other
parts of the code.
parent bde739aced83
No related branches found
No related tags found
No related merge requests found
...@@ -100,6 +100,15 @@ ...@@ -100,6 +100,15 @@
raise error.Abort(_("branch %s not found") % wc.branch()) raise error.Abort(_("branch %s not found") % wc.branch())
return node, movemark, None return node, movemark, None
# order in which each step should be evalutated
# steps are run until one finds a destination
destupdatesteps = ['evolution', 'bookmark', 'branch']
# mapping to ease extension overriding steps.
destupdatestepmap = {'evolution': _destupdateobs,
'bookmark': _destupdatebook,
'branch': _destupdatebranch,
}
def destupdate(repo, clean=False, check=False): def destupdate(repo, clean=False, check=False):
"""destination for bare update operation """destination for bare update operation
...@@ -110,6 +119,5 @@ ...@@ -110,6 +119,5 @@
(cf bookmark.calculate update), (cf bookmark.calculate update),
- activemark: a bookmark to activate at the end of the update. - activemark: a bookmark to activate at the end of the update.
""" """
node = None node = movemark = activemark = None
movemark = activemark = None
...@@ -115,9 +123,8 @@ ...@@ -115,9 +123,8 @@
node, movemark, activemark = _destupdateobs(repo, clean, check) for step in destupdatesteps:
if node is None: node, movemark, activemark = destupdatestepmap[step](repo, clean, check)
node, movemark, activemark = _destupdatebook(repo, clean, check) if node is not None:
if node is None: break
node, movemark, activemark = _destupdatebranch(repo, clean, check)
rev = repo[node].rev() rev = repo[node].rev()
_destupdatevalidate(repo, rev, clean, check) _destupdatevalidate(repo, rev, clean, check)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment