##// END OF EJS Templates

Compare Commits r97:e424cba775fe...r100:2582dee7dd4c

Target:

Source:

Time Author Commit Description
Martin Bornhold
r97:e424cba775fe
subrepo: Add patch to turn off mercurial subrepo handling.
Martin Bornhold
r98:2fa39df61008
subrepo: Add custom exception to indicate subrepo merge conflict.
Martin Bornhold
r99:e1008af8f033
subrepo: Turn off interactive mode when merging mercurial repo. If there is a merge conflict in the sub repositories mercurial will prompt the used to decide which version to use.
Martin Bornhold
r100:2582dee7dd4c
subrepo: Apply mercurial sub repository patch.
@@ -56,6 +56,8 b' UnhandledException = functools.partial(_'
56
56
57 URLError = functools.partial(_make_exception, 'url_error')
57 URLError = functools.partial(_make_exception, 'url_error')
58
58
59 SubrepoMergeException = functools.partial(_make_exception, 'subrepo_merge_error')
60
59
61
60 class HTTPRepoLocked(HTTPLocked):
62 class HTTPRepoLocked(HTTPLocked):
61 """
63 """
@@ -683,6 +683,13 b' class HgRemote(object):'
683 repo = self._factory.repo(wire)
683 repo = self._factory.repo(wire)
684 baseui = self._factory._create_config(wire['config'])
684 baseui = self._factory._create_config(wire['config'])
685 repo.ui.setconfig('ui', 'merge', 'internal:dump')
685 repo.ui.setconfig('ui', 'merge', 'internal:dump')
686
687 # In case of sub repositories are used mercurial prompts the user in
688 # case of merge conflicts or different sub repository sources. By
689 # setting the interactive flag to `False` mercurial doesn't prompt the
690 # used but instead uses a default value.
691 repo.ui.setconfig('ui', 'interactive', False)
692
686 commands.merge(baseui, repo, rev=revision)
693 commands.merge(baseui, repo, rev=revision)
687
694
688 @reraise_safe_exceptions
695 @reraise_safe_exceptions
@@ -35,6 +35,7 b' from mercurial import discovery'
35 from mercurial import unionrepo
35 from mercurial import unionrepo
36 from mercurial import localrepo
36 from mercurial import localrepo
37 from mercurial import merge as hg_merge
37 from mercurial import merge as hg_merge
38 from mercurial import subrepo
38
39
39 from mercurial.commands import clone, nullid, pull
40 from mercurial.commands import clone, nullid, pull
40 from mercurial.context import memctx, memfilectx
41 from mercurial.context import memctx, memfilectx
@@ -58,3 +58,77 b' def _dynamic_capabilities_wrapper(lfprot'
58 return calc_capabilities(repo, proto)
58 return calc_capabilities(repo, proto)
59
59
60 return _dynamic_capabilities
60 return _dynamic_capabilities
61
62
63 def patch_subrepo_type_mapping():
64 from collections import defaultdict
65 from hgcompat import subrepo
66 from exceptions import SubrepoMergeException
67
68 class NoOpSubrepo(subrepo.abstractsubrepo):
69
70 def __init__(self, ctx, path, *args, **kwargs):
71 """Initialize abstractsubrepo part
72
73 ``ctx`` is the context referring this subrepository in the
74 parent repository.
75
76 ``path`` is the path to this subrepository as seen from
77 innermost repository.
78 """
79 self.ui = ctx.repo().ui
80 self._ctx = ctx
81 self._path = path
82
83 def storeclean(self, path):
84 """
85 returns true if the repository has not changed since it was last
86 cloned from or pushed to a given repository.
87 """
88 return True
89
90 def dirty(self, ignoreupdate=False):
91 """returns true if the dirstate of the subrepo is dirty or does not
92 match current stored state. If ignoreupdate is true, only check
93 whether the subrepo has uncommitted changes in its dirstate.
94 """
95 return False
96
97 def basestate(self):
98 """current working directory base state, disregarding .hgsubstate
99 state and working directory modifications"""
100 substate = subrepo.state(self._ctx, self.ui)
101 file_system_path, rev, repotype = substate.get(self._path)
102 return rev
103
104 def remove(self):
105 """remove the subrepo
106
107 (should verify the dirstate is not dirty first)
108 """
109 pass
110
111 def get(self, state, overwrite=False):
112 """run whatever commands are needed to put the subrepo into
113 this state
114 """
115 pass
116
117 def merge(self, state):
118 """merge currently-saved state with the new state."""
119 raise SubrepoMergeException()
120
121 def push(self, opts):
122 """perform whatever action is analogous to 'hg push'
123
124 This may be a no-op on some systems.
125 """
126 pass
127
128 # Patch subrepo type mapping to always return our NoOpSubrepo class
129 # whenever a subrepo class is looked up.
130 subrepo.types = {
131 'hg': NoOpSubrepo,
132 'git': NoOpSubrepo,
133 'svn': NoOpSubrepo
134 }
@@ -354,5 +354,6 b' class ResponseFilter(object):'
354 def main(global_config, **settings):
354 def main(global_config, **settings):
355 if MercurialFactory:
355 if MercurialFactory:
356 hgpatches.patch_largefiles_capabilities()
356 hgpatches.patch_largefiles_capabilities()
357 hgpatches.patch_subrepo_type_mapping()
357 app = HTTPApplication(settings=settings)
358 app = HTTPApplication(settings=settings)
358 return app.wsgi_app()
359 return app.wsgi_app()
@@ -503,5 +503,6 b' class VcsServerCommand(object):'
503 def main(argv=sys.argv, quiet=False):
503 def main(argv=sys.argv, quiet=False):
504 if MercurialFactory:
504 if MercurialFactory:
505 hgpatches.patch_largefiles_capabilities()
505 hgpatches.patch_largefiles_capabilities()
506 hgpatches.patch_subrepo_type_mapping()
506 command = VcsServerCommand(argv, quiet=quiet)
507 command = VcsServerCommand(argv, quiet=quiet)
507 return command.run()
508 return command.run()