Commit Graph

30292 Commits

Author SHA1 Message Date
Gregory Szorc
275bf7db29 debugcommands: move 'debugdeltachain' in the new module 2016-08-17 21:01:02 -07:00
Gregory Szorc
df02df41b0 debugcommands: move 'debugindex' and 'debugindexdot' in the new module 2016-08-17 21:00:11 -07:00
Gregory Szorc
56f5ef7ff5 debugcommands: move 'debugignore' in the new module 2016-08-17 20:59:13 -07:00
Gregory Szorc
1ec64ddf29 debugcommands: move 'debuggetbundle' in the new module 2016-11-10 09:44:47 -08:00
Gregory Szorc
a47dd1170a debugcommands: move 'debugfsinfo' in the new module 2016-08-17 20:58:16 -07:00
Gregory Szorc
c3736a6fe2 debugcommands: move 'debugfileset' in the new module 2016-08-17 20:57:57 -07:00
Remi Chaintron
25e30cf1ed censor: flag internal documentation 2016-11-23 17:36:35 +00:00
Kostia Balytskyi
c89c84d317 shelve: make --keep option survive user intervention (issue5431)
Currently if user runs 'hg unshelve --keep' and merge conflicts
occur, the information about --keep provided by user is lost and
shelf is deleted after 'hg unshelve --continue'. This is obviously
not desired, so this patch fixes it.
2016-11-23 14:58:52 -08:00
Jun Wu
cdd5ade3da worker: use os._exit for posix worker in all cases
Like commandserver, the worker should never run other resource cleanup logic.

Previously this is not true for workers if they have exceptions other than
KeyboardInterrupt.

This actually caused a real-world deadlock with remotefilelog:

1. remotefilelog/fileserverclient creates a sshpeer. pipei/o/e get created.
2. worker inherits that sshpeer's pipei/o/e.
3. worker runs sshpeer.cleanup (only happens without os._exit)
4. worker closes pipeo/i, which will normally make the sshpeer read EOF from
   its stdin and exit. But the master process still have pipeo, so no EOF.
5. worker reads pipee (stderr of sshpeer), which never completes because
   the ssh process does not exit, does not close its stderr.
6. master waits for all workers, which never completes because they never
   complete sshpeer.cleanup.

This could also be addressed by closing these fds after fork, which is not
easy because Python 2.x does not have an official "afterfork" hook. Hacking
os.fork is also ugly. Besides, sshpeer is probably not the only troublemarker.

The patch changes _posixworker so all its code paths will use os._exit to
avoid running unwanted resource clean-ups.
2016-11-24 01:15:34 +00:00
Jun Wu
115ee04855 dispatch: move part of callcatch to scmutil
Per discussion at 7d927e65eaf2 [1], we need "callcatch" in worker.py. Move
it to scmutil.py to avoid cycles.

Note that dispatch's callcatch handles some additional high-level exceptions
related to config parsing, and commands. Moving them to scmutil will make
scmutil depend on "commands" or require "_formatparse" and "_getsimilar"
(and "difflib") to be moved as well. In the worker use-case, it is forked
when config and commands are fully loaded. So it should not care about those
exceptions.

[1]: https://www.mercurial-scm.org/pipermail/mercurial-devel/2016-August/087116.html
2016-11-24 00:48:40 +00:00
Pulkit Goyal
97f340e354 py3: use pycompat.getcwd() instead of os.getcwd()
We have pycompat.getcwd() which returns bytes path on Python 3. This patch
changes most of the occurences of the os.getcwd() with pycompat one.
2016-11-23 00:03:11 +05:30
Gregory Szorc
06abee55d2 debugcommands: move 'debugextensions' to the new module 2016-08-17 20:57:15 -07:00
Gregory Szorc
ba40ffc6e2 debugcommands: move 'debugdiscovery' in the module
And a lot of imports with it.
2016-08-17 20:56:11 -07:00
Gregory Szorc
7264f083ae debugcommands: move 'debugdate' in the new module 2016-08-17 20:43:31 -07:00
Gregory Szorc
cf8519801e debugcommands: move 'debugrevlogopts' into the new module
This move contains the first reference to debugrevlogopts in
debugcommands.py. We'll eventually want to move that over. We
hold off for now because it would introduce a module import cycle.
2016-08-17 20:43:05 -07:00
Gregory Szorc
2ba0f93ffa debugcommands: move 'debugdag' into the new module 2016-08-17 20:41:54 -07:00
Yuya Nishihara
30fe4722fb chgserver: make it a core module and drop extension flags
It was an extension just because there were several dependency cycles I
needed to address.

I don't add 'chgserver' to extensions._builtin since chgserver is considered
an internal extension so nobody should enable it by their config.
2016-10-15 14:30:16 +09:00
Yuya Nishihara
c55a1e0460 chgserver: delay importing commands and dispatch modules
This is a workaround for future import cycle: dispatch -> commands -> server
-> chgserver -> commands. Some of the problems can be fixed later on pager
and chg refactoring.
2016-10-15 14:37:18 +09:00
Yuya Nishihara
98cc069aeb chgserver: drop CHGINTERNALMARK by chgunixservice()
Prepares for the removal of uisetup(). We just need to do that at the start
of the chg server, so chgunixservice() should be fine.
2016-10-15 14:24:29 +09:00
Yuya Nishihara
ba8dd9e4a1 server: add public function to select either cmdserver or hgweb 2016-10-15 14:19:16 +09:00
Yuya Nishihara
cd5b8b18a0 server: move service factory from hgweb 2016-10-15 14:09:36 +09:00
Yuya Nishihara
7a38271c60 hgweb: extract app factory
I'll move createservice() to the server module, but createapp() seems good to
remain in the hgweb module because of its dependency on hgweb/hgwebdir_mod.
2016-10-15 14:06:46 +09:00
Yuya Nishihara
e90ef2b652 server: move service table and factory from commandserver
This is necessary to solve future dependency cycle between commandserver.py
and chgserver.py.

'cmd' prefix is added to table and function names to avoid conflicts with
hgweb.
2016-10-15 13:57:17 +09:00
Yuya Nishihara
dce6c5ba27 server: move cmdutil.service() to new module (API)
And call it runservice() because I'll soon add createservice().

The main reason I'm going to introduce the 'server' module is to solve
future dependency cycle between chgserver.py and commandserver.py.

The 'server' module sits at the same layer as the cmdutil. I believe it's
generally good to get rid of things from the big cmdutil module.
2016-10-15 13:47:43 +09:00
Gregory Szorc
303aeb84db debugcommands: move 'debugcomplete' in the new module 2016-08-17 20:41:05 -07:00
Gregory Szorc
7f445fcd9f debugcommands: move 'debugcommands' in the new module
The commit message isn't an illusion. There is a "debugcommands"
module and command.
2016-08-17 20:40:13 -07:00
Gregory Szorc
a42f62ddd5 debugcommands: move 'debugcheckstate' in the new module 2016-08-17 20:38:29 -07:00
Gregory Szorc
cc37221bd3 debugcommands: move debug{create,apply}streambundleclone to the new module 2016-08-17 20:37:54 -07:00
Gregory Szorc
424411ae17 debugcommands: move 'debugbundle' in the new module 2016-08-17 21:07:22 -07:00
Pulkit Goyal
57f271b08e py3: add os.getcwdb() to have bytes path
Following the behaviour of Python 3, os.getcwd() return unicodes. We need
bytes version as path variables are bytes in UNIX. Python 3 has os.getcwdb()
which returns current working directory in bytes.

Like rest of the things there in pycompat, like osname, ossep, we need to
rewrite every instance of os.getcwd to pycompat.getcwd to make them work
correctly on Python 3.
2016-11-22 18:46:50 +05:30
Gregory Szorc
247c663431 help: clarify contents of revlog index
The previous wording indicated that field at index 3 was the
size of the decompressed chunk, not the size of the full
revision text.
2016-11-22 18:13:02 -08:00
Danek Duvall
267cb097d4 zstd: fix compilation with Solaris Studio
Without these changes, Solaris Studio (12.4) gives us "syntax error: empty
declaration" on these two lines.
2016-11-22 13:32:05 -08:00
Augie Fackler
01092270e8 cmdutil: turn forward of checkunresolved into a deprecation warning
As with dirstateguard, I really doubt anyone outside core was using
this, as my grep over the repositories I keep locally suggests nobody
was using this. If others are comfortable with it, let's drop the
forward entirely.
2016-11-21 21:36:46 -05:00
Augie Fackler
93eca45354 localrepo: refer to checkunresolved by its new name 2016-11-21 21:32:55 -05:00
Augie Fackler
34a63fb4c6 rebase: refer to checkunresolved by its new name 2016-11-21 21:32:39 -05:00
Augie Fackler
a8b9b1e400 checkunresolved: move to new package to help avoid import cycles
This will allow localrepo to stop using cmdutil, which should avoid
some future import cycles. There's room for an adventurous soul to
delve deeper into merge.py and figure out how to disentangle more of
it - it appears to be a nexus of cycle problems. Some of it might be
able to move into this new mergeutil package.
2016-11-21 21:31:45 -05:00
Augie Fackler
d85602ec67 cmdutil: mark dirstateguard as deprecated
I sincerely doubt this is used in external code, as grepping the
extensions I keep locally (including Facebook's hgexperimental and
evolve) indicate nobody outside of core uses this. As such, I'd also
welcome just dropping this name forward entirely.
2016-11-21 21:16:54 -05:00
Augie Fackler
fab0872f32 localrepo: refer to dirstateguard by its new name 2016-11-21 21:06:34 -05:00
Augie Fackler
a75bde8c64 commands: refer to dirstateguard by its new name 2016-11-21 21:06:22 -05:00
Augie Fackler
85ea394346 rebase: refer to dirstateguard by its new name 2016-11-21 21:27:12 -05:00
Augie Fackler
6154ef8eaf mq: refer to dirstateguard by its new name 2016-11-21 21:05:52 -05:00
Augie Fackler
b866e41f24 dirstateguard: move to new module so I can break some layering violations
Recently in a review I noticed that localrepo almost has no reason to
import cmdutil anymore. Also, cmdutil is a little on the enormous
side, so breaking this class out strikes me as a win.
2016-11-21 21:29:32 -05:00
Augie Fackler
f3e514fca2 keepalive: discard legacy Python support for error handling
We never changed the behavior defined by this attribute anyway, so
just jettison all of this support.
2016-11-21 22:17:45 -05:00
Augie Fackler
a9f44c7fb0 mergemod: drop support for merge.update without a target
This was to be deleted after 3.9.
2016-11-21 21:52:19 -05:00
Augie Fackler
d3b8e6d277 dispatch: stop supporting non-use of @command
We said we'd delete this after 3.8. It's time.
2016-11-21 21:51:23 -05:00
Gregory Szorc
825ca90158 httppeer: document why super() isn't used
Adding a follow-up to document lack of super() per Augie's
request.
2016-11-21 20:12:51 -08:00
Stanislau Hlebik
7dd985ce79 exchange: add _getbookmarks() function
This function will be used to generate bookmarks bundle2 part.
It is a separate function in order to make it easy to overwrite it
in extensions. Passing `kwargs` to the function makes it easy to
add new parameters in extensions.
2016-11-17 00:59:41 -08:00
Stanislau Hlebik
c189aa8130 bookmarks: use listbinbookmarks() in listbookmarks() 2016-11-17 00:59:41 -08:00
Stanislau Hlebik
0f78006007 bookmarks: introduce listbinbookmarks()
`bookmarks` bundle2 part will work with binary nodes. To avoid unnecessary
conversions between binary and hex nodes let's add `listbinbookmarks()` that
returns binary nodes. For now this function is a copy-paste of
listbookmarks(). In the next patch this copy-paste will be removed.
2016-11-17 00:59:41 -08:00
Kostia Balytskyi
652e43055e ui: add configoverride context manager
I feel like this idea might've been discussed before, so please
feel free to point me to the right mailing list entry to read
about why it should not be done.

We have a common pattern of the following code:
    backup = ui.backupconfig(section, name)
    try:
        ui.setconfig(section, name, temporaryvalue, source)
        do_something()
    finally:
        ui.restoreconfig(backup)

IMO, this looks better:
    with ui.configoverride({(section, name): temporaryvalue}, source):
        do_something()

Especially this becomes more convenient when one has to backup multiple
config values before doing something. In such case, adding a new value
to backup requires codemod in three places.
2016-11-21 16:22:26 -08:00