Commit Graph

30 Commits

Author SHA1 Message Date
Yuya Nishihara
96a8ea56df cmdserver: forcibly use L channel to read password input (issue3161)
Command server is designed to use the channel protocol even if the server
process is accessible to tty, whereas vanilla hg should be able to read
password from tty in that case.  So it isn't enough to swap sys.stdin:

    # works only if the server process is detached from the console
    sys.stdin = self.fin
    getpass.getpass('')
    sys.stdin = oldin

or test isatty:

    # vanilla hg can't talk to tty if stdin is redirected
    if self._isatty(self.fin):
        return getpass.getpass('')
    else:
        ...

Since ui.nontty flag is undocumented and command-server channels don't provide
isatty(), this change won't affect the other uses of ui._isatty().

issue3161 also suggests to provide some context of messages.  I think it can
be implemented by using the generic templating function.
2014-04-26 18:13:06 +09:00
Yuya Nishihara
b6eb1297a9 cmdserver: allow to start server without repository
Typical use case is to clone repository through command server.  Clone may
require user interaction, so command-server protocol is beneficial over
raw stdio channels.
2014-03-03 23:21:24 +09:00
Yuya Nishihara
8fcb453c5c cmdserver: prepare test for starting server without repository 2014-03-03 23:11:17 +09:00
Yuya Nishihara
da4723cea3 cmdserver: mask return code of runcommand in the same way as dispatch.run
"hg help" does not state that the code for abort is 255, but it's confusing
to have different code between hg command and command server.

Tests of python-hglib 1.2 passed with this change.
2014-03-03 15:50:51 +09:00
Yuya Nishihara
4d6229a6b6 cmdserver: include non-zero return code of runcommand in test output 2014-03-03 15:50:48 +09:00
Yuya Nishihara
16bbd89ec4 cmdserver: recreate mq object on runcommand in case queue path was changed
repo.mq needs to be recreated after queue path change.  Since there is little
benefit to keep invalidated mq object, it always delete repo.mq.
2014-03-03 19:41:30 +09:00
Yuya Nishihara
ff2e18c10c cmdserver: reload mq on each runcommand request to avoid corruption
If mq was changed by another process, command server should invalidate caches.
Otherwise, mq status would go wrong.
2014-03-03 19:41:26 +09:00
Simon Heimberg
2fbc376260 tests: on windows, run command explicitly in sh for working command substitution
On windows, os.system runs the command in cmd.exe, which does not know command
substitution. To let this work, run the command explicitly in sh.

This fixes the failure of this test on windows.
2014-02-08 10:41:17 +01:00
Julien Cristau
e78105c48a dispatch: take --hidden from individual commands into account
The command server would otherwise ignore that option, since the repo
object is only created once.
2014-01-27 10:57:20 +01:00
Matt Mackall
15d52a5074 merge with stable 2013-05-09 15:22:21 -05:00
Matt Mackall
43b6b506f1 tests: quiet strip to avoid commandserver pathsep issue 2013-05-09 15:17:29 -05:00
Brendan Cully
dd29f61cae tests: fix test-commandserver phase . output for windows 2013-05-03 13:59:58 -07:00
Idan Kamara
8e15165a57 localrepo: always write the filtered phasecache when nodes are destroyed (issue3827)
When the strip command is run, it calls repo.destroyed, which in turn checks if
we read _phasecache, and if we did calls filterunknown on it and flushes the
changes immediately. But in some cases, nothing causes _phasecache to be read,
so we miss out on this and the file remains the same on-disk.

Then a call to invalidate comes, which should refresh _phasecache if it
changed, but it didn't, so it keeps using the old one with the stripped
revision which causes an IndexError.

Test written by Yuya Nishihara.
2013-03-23 13:34:50 +02:00
Brodie Rao
92158e04de cleanup: "raise SomeException()" -> "raise SomeException" 2012-05-12 16:00:58 +02:00
Brodie Rao
d6a6abf2b0 cleanup: eradicate long lines 2012-05-12 15:54:54 +02:00
Idan Kamara
653ad0c355 dirstate: filecacheify _ignore (issue3278)
This still doesn't handle the case where a command is run with
--config ui.ignore=path since we only look for changes in .hgignore.
2012-03-01 17:49:59 +02:00
Idan Kamara
ca3ebc8b96 dirstate: filecacheify _branch
The opener is relative to .hg, use it in a subclass of filecache to compute
the final path.
2012-03-01 17:42:49 +02:00
Idan Kamara
e771a65076 test-commandserver: flush stdout 2012-02-16 01:23:45 +02:00
Idan Kamara
1e4d0cc218 localrepo: clear _filecache on rollback (issue3261)
Files are being replaced by rollback but the corresponding data in localrepo
isn't actually updated for things like bookmarks, phases, etc. Then when
rollback is done, the cache is updated thinking it has the most up-to-date
data, where in fact it is still pre-rollback.

We clear _filecache to force everything to be recreated.
2012-02-16 01:21:34 +02:00
Idan Kamara
f729c0ef8a scmutil: update cached copy when filecached attribute is assigned (issue3263)
When assigning a new object to filecached properties, the cached object that
was kept in the _filecache map was still holding the old object.

By implementing __set__, we track these changes too and update the cached
copy as well.
2012-02-15 20:02:35 +02:00
Idan Kamara
351bf40844 cmdserver: invalidate the dirstate when running commands (issue3271)
The dirstate is invalidated separately outside of invalidate() which is
already being called (other callers of invalidate() seems to suggest the
separation is there for a reason).
2012-02-15 23:44:10 +02:00
Idan Kamara
3e9227d2bd test-commandserver: test that phase data is being refreshed 2012-01-26 00:21:55 +02:00
Mads Kiilerich
df6c03ed7a tests: make test-commandserver.py independent of line ending and slash direction 2011-11-21 00:39:32 +01:00
Mads Kiilerich
a71b0e4d4e tests: make test-commandserver.py output readable 2011-11-21 00:39:32 +01:00
Idan Kamara
ce5a7b8382 cmdserver: repo.invalidate() on every runcommand
This will trigger the filecache and recreate every cached property that was
changed by something other than this cmdserver instance (e.g. by running
'hg commit' at the cmdline).
2011-07-25 22:19:28 +03:00
Idan Kamara
76465b4a18 hooks: redirect stdout/err/in to the ui descriptors when calling python hooks
We need to make sure that python hooks I/O goes through the ui descriptors so
it doesn't mess the command server protocol.
2011-07-09 19:06:59 +03:00
Idan Kamara
bab89cfab6 cmdserver: take repo.baseui as our ui
The ui passed to server() is really repo.ui, that is it contains its local
configuration as well.

When running commands that use a different repo than the servers cached repo,
we don't want to use that ui as the baseui for the new repo.
2011-07-14 11:46:15 +03:00
Idan Kamara
d17c3e4003 test-commandserver: explicitly close opened file 2011-07-15 16:28:09 +03:00
Idan Kamara
550bca7579 cmdserver: restore old working dir after dispatch when we have --cwd 2011-07-11 17:49:45 +03:00
Idan Kamara
02ffbb9696 tests: add basic commandserver test 2011-06-29 15:49:35 +03:00