Mercurial > hg > mercurial-crew-with-dirclash
annotate hgext/win32text.py @ 2901:05f357b70cb0
Tune a bit the extdiff toplevel comments/samples.
* Capitalize the first letter of all sentences
* Add an example for GNU diff(1) 'context diff' mode.
* Explain the requirement for separate cmd.xxx and opts.xxx
options in .hgrc, which hopefully will guard against users
trying to add:
[extdiff]
# Add a new Mercurial command called `cdiff', which calls
# GNU diff(1) in 'context diff' mode.
cmd.cdiff = diff -Nprc5
which fails for recent crew builds with:
$ hg cdiff .
making snapshot of 1 files from rev 07dc4a569f4e
making snapshot of 1 files from working dir
diff -Nprc5: not found
The correct way to do this is by separating the cmd.cdiff and
opts.cdiff parts like this:
[extdiff]
# Add a new Mercurial command called `cdiff', which calls
# GNU diff(1) in 'context diff' mode.
cmd.cdiff = diff
opts.cdiff = -Nprc5
so add it as a new example and explicitly describe it in the
extdiff comments.
author | Giorgos Keramidas <keramida@ceid.upatras.gr> |
---|---|
date | Tue, 15 Aug 2006 18:14:58 +0300 |
parents | e58b1c9a0dec |
children | 30762680fcd2 |
rev | line source |
---|---|
1297
496074e0a38b
Add win32text extension module.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
1 import mercurial.util |
496074e0a38b
Add win32text extension module.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
2 |
496074e0a38b
Add win32text extension module.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
3 def dumbdecode(s, cmd): |
496074e0a38b
Add win32text extension module.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
4 return s.replace('\n', '\r\n') |
496074e0a38b
Add win32text extension module.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
5 |
496074e0a38b
Add win32text extension module.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
6 def dumbencode(s, cmd): |
496074e0a38b
Add win32text extension module.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
7 return s.replace('\r\n', '\n') |
496074e0a38b
Add win32text extension module.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
8 |
496074e0a38b
Add win32text extension module.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
9 def clevertest(s, cmd): |
496074e0a38b
Add win32text extension module.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
10 if '\0' in s: return False |
496074e0a38b
Add win32text extension module.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
11 return True |
496074e0a38b
Add win32text extension module.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
12 |
496074e0a38b
Add win32text extension module.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
13 def cleverdecode(s, cmd): |
496074e0a38b
Add win32text extension module.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
14 if clevertest(s, cmd): |
496074e0a38b
Add win32text extension module.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
15 return dumbdecode(s, cmd) |
496074e0a38b
Add win32text extension module.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
16 return s |
496074e0a38b
Add win32text extension module.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
17 |
496074e0a38b
Add win32text extension module.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
18 def cleverencode(s, cmd): |
496074e0a38b
Add win32text extension module.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
19 if clevertest(s, cmd): |
496074e0a38b
Add win32text extension module.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
20 return dumbencode(s, cmd) |
496074e0a38b
Add win32text extension module.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
21 return s |
496074e0a38b
Add win32text extension module.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
22 |
496074e0a38b
Add win32text extension module.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
23 mercurial.util.filtertable.update({ |
496074e0a38b
Add win32text extension module.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
24 'dumbdecode:': dumbdecode, |
496074e0a38b
Add win32text extension module.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
25 'dumbencode:': dumbencode, |
496074e0a38b
Add win32text extension module.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
26 'cleverdecode:': cleverdecode, |
496074e0a38b
Add win32text extension module.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
27 'cleverencode:': cleverencode, |
496074e0a38b
Add win32text extension module.
Bryan O'Sullivan <bos@serpentine.com>
parents:
diff
changeset
|
28 }) |