mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 00:14:35 +03:00
main: add mercurial.main as an entry point
Summary: The old mercurial.dispatch entry point works, except it breaks extensions wrapping `dispatch.*` (ex. `dispatch.runcommand`). That is because things happen in this order: - Buck's python wrapper imports `mercurial.dispatch` as mod1. - hgdemandimport is enabled. - An extension imports `mercurial.dispatch` and it got mod2. - mod2 != mod1. So any changes to mod2 won't be used. Using a separate module (`mercurial.main`) as the entry point solves the problem. Reviewed By: DurhamG Differential Revision: D6879873 fbshipit-source-id: 9779edac64bbeb53dd98dfab1b21575c3a60af01
This commit is contained in:
parent
5dabd90466
commit
f623fe9d3c
@ -5,7 +5,7 @@
|
||||
# This software may be used and distributed according to the terms of the
|
||||
# GNU General Public License version 2 or any later version.
|
||||
|
||||
from __future__ import absolute_import, print_function
|
||||
from __future__ import absolute_import
|
||||
|
||||
import difflib
|
||||
import errno
|
||||
@ -1010,8 +1010,3 @@ def rejectpush(ui, **kwargs):
|
||||
# mercurial hooks use unix process conventions for hook return values
|
||||
# so a truthy return means failure
|
||||
return True
|
||||
|
||||
if __name__ == '__main__':
|
||||
import hgdemandimport
|
||||
hgdemandimport.enable()
|
||||
run()
|
||||
|
12
mercurial/main.py
Normal file
12
mercurial/main.py
Normal file
@ -0,0 +1,12 @@
|
||||
# Copyright 2018 Facebook, Inc.
|
||||
#
|
||||
# This software may be used and distributed according to the terms of the
|
||||
# GNU General Public License version 2 or any later version.
|
||||
|
||||
from __future__ import absolute_import
|
||||
|
||||
if __name__ == '__main__':
|
||||
import hgdemandimport
|
||||
hgdemandimport.enable()
|
||||
from . import dispatch
|
||||
dispatch.run()
|
Loading…
Reference in New Issue
Block a user