Commit Graph

11862 Commits

Author SHA1 Message Date
Renato Cunha
49c247ab1e hgfixes: added a fixer that makes bytes to be formatted correctly
This patch implement a fixer that replaces all calls to the '%' when bytes
arguments are used to a call to bytesformatter(), a function that knows how to
format byte strings. As one can't be sure if a formatting call is done when
only variables are used in a '%' call, these calls are also translated. The
bytesformatter, in runtime, makes sure to return the "raw" % operation if
that's what was intended.
2010-08-03 13:59:14 -03:00
Renato Cunha
48aa19eddb py3kcompat: added a "compatibility layer" for py3k
This patch adds some ugly constructs. The first of them is bytesformatter, a
function that formats strings like when '%' is called. The main motivation for
this function is py3k's strange behavior:

>>> 'foo %s' % b'bar'
"foo b'bar'"
>>> b'foo %s' % b'bar'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for %: 'bytes' and 'bytes'
>>> b'foo %s' % 'bar'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: unsupported operand type(s) for %: 'bytes' and 'str'

In other words, if we can't format bytes with bytes, and recall that all
mercurial strings will be converted by a fixer, then things will break badly if
we don't take a similar approach.

The other addition with this patch is that the os.environ dictionary is
monkeypatched to have bytes items. Hopefully this won't be needed in the
future, as python 3.2 might get a os.environb dictionary that holds bytes
items.
2010-08-03 13:52:48 -03:00
Renato Cunha
09994866c3 hgfixes: add a fixer to convert plain strings to bytestrings
This patch implements a 2to3 fixer that converts all plain strings in a python
source file to byte strings syntax. Example:

foo = 'Normal string'

would become

foo = b'Normal string'

The motivation behind this fixer can be found in
http://selenic.com/pipermail/mercurial-devel/2010-June/022363.html or, in other
words: the current hg source assumes that _most_ strings are "meant" to be byte
sequences, so it makes sense to make the convertion implemented by this patch.

As mentioned above, not all mercurial modules want to use strings as bytes,
examples include i18n (which uses unicode), and demandimport (in py3k, module
names are normal strings, thus unicode, and there's no need for a convertion).
Therefore, these modules are blacklisted in the fixer. There are also a few
functions that can take only unicode arguments, thus the convertion shouldn't
be done for those.
2010-08-03 13:41:47 -03:00
Vishakh H
04014eeaa3 revlog: add shallow header flag
REVLOGSHALLOW header flag to mark revlog as shallow.
The _shallow attribute of the revlog is used to check if the header flag is set.
2010-08-03 19:38:19 +05:30
Vishakh H
22c7674a18 revlog: add punched revision flag
index flag to identify a revision as punched, i.e. it contains no data.
REVIDX_PUNCHED_FLAG = 2, is used to mark a revision as punched.
REVIDX_KNOWN_FLAGS is the accumulation of all index flags.
2010-08-03 19:38:19 +05:30
Matt Mackall
c5f0a941ed tests: unify test-tags 2010-08-03 00:10:28 -05:00
Matt Mackall
ff20c29dfa tests: unify test-empty 2010-08-02 23:43:06 -05:00
Matt Mackall
cfd4fc0439 tests: unify test-basic 2010-08-02 23:29:14 -05:00
Matt Mackall
0e5ee51c54 tests: basic support for unified tests 2010-08-02 23:27:22 -05:00
Matt Mackall
fb4712adac tests: move script execution in runner helpers 2010-08-02 15:44:54 -05:00
Matt Mackall
207503a99c Merge with stable 2010-08-02 13:31:43 -05:00
Matt Mackall
eb9688c21b Added signature for changeset 2ba1c79582c1 2010-08-02 13:30:03 -05:00
Wagner Bruna
aad618dae1 i18n-pt_BR: synchronized with 71d680aaf056 2010-08-02 13:18:32 -03:00
Wagner Bruna
7d8221a322 merge with i18n stable 2010-08-02 13:11:33 -03:00
Matt Mackall
8b11223ff6 Merge with stable 2010-08-02 10:55:51 -05:00
Brodie Rao
6d1ff05d76 color: call correct superclass method in write_err
Without this fix, any calls to write_err would go to stdout instead of
stderr, and calls during pushbuffer would cause unpack ValueErrors on
popbuffer.
2010-08-02 10:48:31 -04:00
Matt Mackall
a807136972 qfinish: fix range logic for --applied
qbase:qtip can include non-mq csets, use qbase::qtip instead
2010-08-01 16:02:56 -05:00
Jens Bäckman
47edbf0312 i18n-sv: synchronized with 8e5f91eaa8aa 2010-08-01 22:43:13 +02:00
Matt Mackall
1c87d5c9ea Added signature for changeset d148773f9fea 2010-08-01 13:49:43 -05:00
Wagner Bruna
6724dcd0ac i18n-pt_BR: synchronized with 2400fe9a120f 2010-08-01 01:54:31 -03:00
Wagner Bruna
60ab0bce52 Merge with stable 2010-08-01 01:51:21 -03:00
Wagner Bruna
b59d3846ed i18n-pt_BR: synchronized with 4a5d74d26ead 2010-08-01 01:46:58 -03:00
timeless
4c60b4bbe9 convert/progress: use plural and avoid retrieving 2010-07-30 10:38:54 +03:00
Brodie Rao
52fb27575c color: pass write/write_err to win32print correctly (issue2312) 2010-08-01 16:26:02 -04:00
timeless
bf09d7af0f progress: use gerund (updating) for merge progress 2010-07-30 10:32:24 +03:00
Lee Cantey
8d38db4335 Remove variable output affected by length of TMPDIR.
If the temporary directory is longer than /tmp then it's possible that
the Subject line will get wrapped by the headencode function.
2010-07-25 08:22:03 -07:00
Jens Bäckman
e0345437eb i18n-sv: synchronized with 580cace209b4 2010-07-25 10:51:05 +02:00
Martin Geisler
4e818c92d7 help: make helptable a list instead of a tuple
The table should always have been a list so that extensions can append
their own help topics -- hgsubversion would like to do this now.
2010-07-22 21:43:45 +02:00
Matt Mackall
4e44d8a129 revset: fix ancestor subset handling (issue2298) 2010-07-22 08:17:38 -05:00
timeless
ead95bc677 rebase/progress: Adding progress for rebasing 2010-07-20 20:53:48 +02:00
timeless
220a53c8c9 record: count lines changed as the number of lines added or removed
per "record" hunk
Record deals in hunks which are tighter than traditional patch hunks,
really only a single run of additions/removals. Another addition, even a
line after a fixed line is treated as a new hunk by record.
2010-07-22 18:47:46 +03:00
Matt Mackall
c485ed2759 Merge with stable 2010-08-01 13:52:42 -05:00
Matt Mackall
a313776246 Merge with stable 2010-08-01 08:54:30 -05:00
Matt Mackall
9cc346f0b4 help: fix bytes/digit confusion for hashes
spotted by FUJIWARA Katsunori <fujiwara@ascade.co.jp>
2010-07-31 18:27:03 -05:00
Matt Mackall
c11fac2ec1 Merge with stable 2010-07-31 18:12:50 -05:00
Nicolas Dumazet
2476f9eec3 merge with stable 2010-07-31 11:41:58 +09:00
Nicolas Dumazet
3186d42f7f perf: break down long line 2010-07-31 11:41:42 +09:00
Nicolas Dumazet
576074569c dispatch: trailing whitespace 2010-07-31 11:36:24 +09:00
Nicolas Dumazet
fd74fbf55f merge crew and main 2010-07-31 11:05:11 +09:00
Nicolas Dumazet
1f6d6b4984 merge crew and main 2010-07-31 11:04:33 +09:00
Nicolas Dumazet
5d294189fa mq: clarify the fact that qimport is trying to read a file
"hg qimport tip" would throw "abort: unable to read tip" before this.
2010-07-31 10:50:29 +09:00
Nicolas Dumazet
0e9b05da3e runrst: try to be more helpful if docutils is not installed 2010-07-30 14:41:47 +09:00
Nicolas Dumazet
5ab42d56dc revset: add min function 2010-07-30 10:07:46 +09:00
Nicolas Dumazet
e1fdb57c43 mq: correct qimport documentation 2010-07-29 17:18:17 +09:00
Nicolas Dumazet
255cce8ee5 merge with stable 2010-07-29 12:10:22 +09:00
Nicolas Dumazet
659bdb87ec context: reuse filecontext.cmp in workingfilecontext.cmp
Same code path should mean less mistakes, and hopefully, better
caching.
2010-07-29 10:39:59 +09:00
Matt Mackall
272a0b3fc3 Merge with stable 2010-07-27 16:04:00 -05:00
Matt Mackall
f93eb1deca Merge with crew 2010-07-27 16:03:42 -05:00
Benjamin Pollack
728f9bcc7e tag: do not allow tag names to consist solely of whitespace (issue2307)
(simplification and test by mpm)
2010-07-27 14:40:25 -04:00
Nicolas Dumazet
064d677bd7 filectx: use cmp(self, fctx) instead of cmp(self, text)
This allows more flexibility in implementation, and in particular,
lets the context decide if revision text has to be loaded or not.
2010-07-27 23:40:46 +09:00