##// END OF EJS Templates
cmdserver: forcibly use L channel to read password input (issue3161)...
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.

File last commit:

r12316:4134686b default
r21195:9336bc7d stable
Show More
test-custom-filters.t
66 lines | 1.5 KiB | text/troff | Tads3Lexer
/ tests / test-custom-filters.t
$ hg init
$ cat > .hg/hgrc <<EOF
> [extensions]
> prefixfilter = prefix.py
> [encode]
> *.txt = stripprefix: Copyright 2046, The Masters
> [decode]
> *.txt = insertprefix: Copyright 2046, The Masters
> EOF
$ cat > prefix.py <<EOF
> from mercurial import util
> def stripprefix(s, cmd, filename, **kwargs):
> header = '%s\n' % cmd
> if s[:len(header)] != header:
> raise util.Abort('missing header "%s" in %s' % (cmd, filename))
> return s[len(header):]
> def insertprefix(s, cmd):
> return '%s\n%s' % (cmd, s)
> def reposetup(ui, repo):
> repo.adddatafilter('stripprefix:', stripprefix)
> repo.adddatafilter('insertprefix:', insertprefix)
> EOF
$ cat > .hgignore <<EOF
> .hgignore
> prefix.py
> prefix.pyc
> EOF
$ cat > stuff.txt <<EOF
> Copyright 2046, The Masters
> Some stuff to ponder very carefully.
> EOF
$ hg add stuff.txt
$ hg ci -m stuff
Repository data:
$ hg cat stuff.txt
Some stuff to ponder very carefully.
Fresh checkout:
$ rm stuff.txt
$ hg up -C
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
$ cat stuff.txt
Copyright 2046, The Masters
Some stuff to ponder very carefully.
$ echo "Very very carefully." >> stuff.txt
$ hg stat
M stuff.txt
$ echo "Unauthorized material subject to destruction." > morestuff.txt
Problem encoding:
$ hg add morestuff.txt
$ hg ci -m morestuff
abort: missing header "Copyright 2046, The Masters" in morestuff.txt
[255]
$ hg stat
M stuff.txt
A morestuff.txt