Commit Graph

16693 Commits

Author SHA1 Message Date
Adrian Buehlmann
dae9e15d0a win32: use Python's _winreg again
This is a partial backout of 7efea3b5db4c.

7efea3b5db4c switched win32.py to using ctypes with the intention to get rid
of the dependency on the pywin32 package.

But 7efea3b5db4c replaced the usage of the Python standard module _winreg in
lookup_reg as well, which was uneeded (note that lookup_reg was later renamed
into lookupreg).

Basically, we're switching back to the previous _winreg-based implementation,
which uses _winreg.QueryValueEx(). QueryValueEx returns a unicode code string.

See also: issue3467
2012-05-27 11:29:45 +02:00
Bryan O'Sullivan
509438662e lsprof: report units correctly 2012-05-30 13:57:41 -07:00
Bryan O'Sullivan
bef5b61512 cleanup: use the deque type where appropriate
There have been quite a few places where we pop elements off the
front of a list.  This can turn O(n) algorithms into something more
like O(n**2).  Python has provided a deque type that can do this
efficiently since at least 2.4.

As an example of the difference a deque can make, it improves
perfancestors performance on a Linux repo from 0.50 seconds to 0.36.
2012-05-15 10:46:23 -07:00
Bryan O'Sullivan
45a54a6b08 perf: add a perfancestors benchmark 2012-05-15 10:44:17 -07:00
Matt Mackall
662b1241be merge with stable 2012-05-30 14:31:51 -05:00
Matt Mackall
b49b66c0f2 merge with crew 2012-05-30 14:31:39 -05:00
Matt Mackall
2d85685b68 merge with i18n 2012-05-30 14:31:29 -05:00
Matt Mackall
bfe92722a0 merge with stable 2012-05-30 14:21:58 -05:00
Matt Mackall
d4e4a5b5be revpair: handle odd ranges (issue3474) 2012-05-30 14:13:57 -05:00
FUJIWARA Katsunori
53d7bfd5d8 i18n-ja: synchronized with 878641b4f1d3 2012-05-29 21:32:50 +09:00
Alexander Sauta
785c6458c0 i1n-ru:synchronized with 0ee6800b3663 2012-05-27 15:37:36 +01:00
Wagner Bruna
fadad79d3f i18n-pt_BR: synchronized with 8381a52c9211 2012-05-27 09:52:25 -03:00
Thomas Arendsen Hein
6c60809dcc merge: show renamed on one and deleted on the other side in debug output 2012-05-23 21:34:29 +02:00
Thomas Arendsen Hein
91a8201c52 merge: warn about file deleted in one branch and renamed in other (issue3074)
For divergent renames the following message is printed during merge:
note: possible conflict - file was renamed multiple times to:
 newfile
 file2

When a file is renamed in one branch and deleted in the other, the file still
exists after a merge. With this change a similar message is printed for mv+rm:

note: possible conflict - file was deleted and renamed to:
 newfile
2012-05-23 20:50:16 +02:00
Thomas Arendsen Hein
d79df9bd09 tests: do not create repos inside repos in test-rename-merge1.t
This is no actual problem, but I when adding more tests to this file,
the directory structure would become t/repo2089/repoXXXX/repoYYYY/...
2012-05-23 17:33:19 +02:00
Thomas Arendsen Hein
4735ff24c9 merge: do not warn about copy and rename in the same transaction (issue2113) 2012-05-23 17:25:48 +02:00
Matt Mackall
8c3c80ff37 merge with stable 2012-05-22 14:37:20 -05:00
FUJIWARA Katsunori
abfb6c35d4 match: make 'match.files()' return list object always
'exact' match objects are sometimes created with a non-list 'pattern'
argument:

  - using 'set' in queue.refresh():hgext/mq.py
        match = scmutil.matchfiles(repo, set(c[0] + c[1] + c[2] + inclsubs))

  - using 'dict' in revert():mercurial/cmdutil.py (names = {})
        m = scmutil.matchfiles(repo, names)

'exact' match objects return specified 'pattern' to callers of
'match.files()' as it is, so it is a non-list object.

but almost all implementations expect 'match.files()' to return a list
object, so this may causes problems: e.g. exception for "+" with
another list object.

this patch ensures that '_files' of 'exact' match objects is a list
object.

for non 'exact' match objects, parsing specified 'pattern' already
ensures that it it a list one.
2012-05-23 00:25:29 +09:00
Patrick Mezard
139c15da66 revset: fix infinite alias expansion detection
The alias expansion code it changed from:
1- Get replacement tree
2- Substitute arguments in the replacement tree
3- Expand the replacement tree again

into:

1- Get the replacement tree
2- Expand the replacement tree
3- Expand the arguments
4- Substitute the expanded arguments in the replacement tree

and fixes cases like:

  [revsetalias]
  level1($1, $2) = $1 or $2
  level2($1, $2) = level1($2, $1)

  $ hg log -r "level2(level1(1, 2), 3)"

where the original version incorrectly aborted on infinite expansion
error, because it was confusing the expanded aliases with their
arguments.
2012-05-19 17:19:55 +02:00
Patrick Mezard
c7a80dee31 revset: explicitely tag alias arguments for expansion
The current revset alias expansion code works like:
1- Get the replacement tree
2- Substitute the variables in the replacement tree
3- Expand the replacement tree

It makes it easy to substitute alias arguments because the placeholders
are always replaced before the updated replacement tree is expanded
again. Unfortunately, to fix other alias expansion issues, we need to
reorder the sequence and delay the argument substitution. To solve this,
a new "virtual" construct called _aliasarg() is introduced and injected
when parsing the aliases definitions. Only _aliasarg() will be
substituted in the argument expansion phase instead of all regular
matching string. We also check user inputs do not contain unexpected
_aliasarg() instances to avoid argument injections.
2012-05-19 17:18:29 +02:00
Augie Fackler
3dc5160169 util: fix bad variable use in bytecount introduced by ad5e3bec298e 2012-05-21 14:24:24 -05:00
Matt Mackall
ca006af287 context: grudging accept longs in constructor 2012-05-21 16:32:50 -05:00
Matt Mackall
c082b3d973 win32: fix encoding handling for registry strings (issue3467)
This stopped handling non-ASCII strings in 1.8
2012-05-21 16:32:49 -05:00
Bryan O'Sullivan
7ddd8678d8 perf: add a perfdirstatewrite benchmark 2012-05-16 13:45:46 -07:00
Bryan O'Sullivan
1e9deb3b01 parsers: cache the result of index_headrevs
Although index_headrevs is much faster than its Python counterpart,
it's still somewhat expensive when history is large. Since headrevs
is called several times when the tag cache is stale or missing (e.g.
after a strip or rebase), there's a win to be gained from caching
the result, which we do here.
2012-05-19 20:21:48 -07:00
Bryan O'Sullivan
a49ea963d7 revlog: switch to a C version of headrevs
The C implementation is more than 100 times faster than the Python
version (which is still available as a fallback).

In a repo with 330,000 revs and a stale .hg/cache/tags file, this
patch improves the performance of "hg tip" from 2.2 to 1.6 seconds.
2012-05-19 19:44:58 -07:00
Bryan O'Sullivan
18476b4834 perf: rework perfheads and perftags to clear caches
The cache clearing makes numbers more reproducible.
2012-05-19 19:44:23 -07:00
Bryan O'Sullivan
f9c29929d4 parsers: reduce raw_length when truncating
When stripping revs, we now update raw_length to correctly reflect
the new end of the index.
2012-05-19 19:44:18 -07:00
Olav Reinert
39ea6b3464 help: inline helper function used once only 2012-05-22 22:08:41 +02:00
Olav Reinert
a1155c64ad help: remove redundant parameter 2012-05-22 22:08:41 +02:00
Olav Reinert
b372d3da28 help: move some helper functions to help.py 2012-05-22 22:08:41 +02:00
Olav Reinert
2dabd3c23f help: remove dependency on ui from some helper functions 2012-05-22 22:08:41 +02:00
David Schleimer
fc014ab773 hg-ssh: refactor to have main() method
Refactor hg-ssh to have a main() function instead of a bunch of
top-level statements.
2012-05-21 16:19:30 -07:00
FUJIWARA Katsunori
db8047a1c0 doc: add detail explanation for 'present()' predicate of revsets 2012-05-16 17:02:30 +09:00
Matt Mackall
1af38adeb7 osutil: handle deletion race with readdir/stat (issue3463) 2012-05-18 14:34:33 -05:00
Matt Mackall
4bd5c2d220 merge with i18n 2012-05-17 12:15:30 -05:00
Alexander Sauta
4b12c54fc2 i18n-ru: synchronized with 88b33d9639ed 2012-05-15 14:58:16 +01:00
Sune Foldager
aea3159eaa bundle: make bundles more portable (isue3441)
This is achieved by acting as if the user had given -r<rev> for each head rev
of outgoing changesets on the command line, as well as appropriate
--base <rev>.

The discovery information is computed as normal, and then adjusted as above.
2012-05-12 19:38:20 +02:00
Matt Harbison
353d5deeb2 revset: fix traceback for bogus revisions in id(rev)
hg log -r "id(1234567)" now returns an empty list like rev() does.
2012-05-14 19:25:13 -04:00
Thomas Arendsen Hein
6dc228e4f6 Makefile: remove generated mercurial/__version__.py 2012-05-15 12:44:07 +02:00
Mark Round
7b5857715d posix: workaround lack of TIOCGWINSZ on Irix (issue3449)
On an Irix 6.5.24 system, TIOCGWINSZ is not available. This means that
any usage of the "hg" tool that looks up the terminal size (e.g. "hg
help") will fail with an AttributeError.

A simple work-around is just to wrap this block in mercurial/posix.py
with a try/except so that it ends up using the default 80 characters
width.
2012-05-14 13:25:42 +01:00
Matt Mackall
dbfb64e582 hgweb: fix filediff base calculation
Previously, we were finding the most recent version of a file in a
changeset and comparing it against its first file parent. This was
wrong on three counts:

- it would show a diff in revisions where there was no change to a file
- it would show a diff when only the exec bit changed
- it would potentially compare against a much older changeset, which
  could be very expensive if git-style rename detection was enabled

This compares the file in the current context with that context's
parent, which may result in an empty diff when looking at a file not
touched by the current changeset.
2012-05-14 12:56:43 +02:00
Mads Kiilerich
b315fbc5ab largefiles: use wlock for lfconvert (issue3444)
largefiles and lfconvert do dirty hacks with dirstate, so to avoid writing that
as a side effect of the wlock release we clear dirstate first.

To avoid confusing lock validation algorithms in error situations we unlock
_before_ removing the target directory.
2012-05-13 17:34:55 +02:00
Matt Mackall
732d9d463a merge with i18n 2012-05-13 11:19:48 +02:00
Patrick Mezard
83a4a6c7b9 graphlog: turn getlogrevs() into a generator
This improves the poor "time to first changeset" compared to the
original log command. When running:

  $ hg log -u user

log will enumerate the changelog and display matching revisions when
they are found. But:

  $ hg log -G -u user

will first find all revisions matching the user then start to display
them.

Initially, I considered turning revset.match() into a generator. This is
doable but requires a fair amount of work. Instead,
cmdutil.increasingwindows() is reused to call the revset matcher
repeatedly. This has the nice properties of:
- Let us reorder the windows after filtering, which is necessary as the
  matcher can reorder inputs but is an internal detail not a feature.
- Let us feed the matcher with windows in changelog order, which is good
  for performances.
- Have a generator designed for log-like commands, returning small
  windows at first then batching larger ones.

I feel that calling the matcher multiple times is correct, at least with
the revsets involved in getlogrevs() because they are:
- stateless (no limit())
- respecting f(a|b) = f(a) | f(b), though I have no valid argument about
  that.

Known issues compared to log code:
- Calling the revset matcher multiple times can be slow when revset
  functions have to create expensive data structure for filtering. This
  will be addressed in a followup.
- Predicate combinations like "--user foo --user bar" or "--user foo and
  --branch bar" are inherently slower because all input revision are
  checked against the first condition, then against the second, and so
  forth. log would enumerate the input revisions once and check each of
  them once against all conditions, which is faster. There are solutions
  but nothing cheap to implement.

Some numbers against mozilla repository:

                             first line    total

  * hg log -u rnewman
  /Users/pmezard/bin/hg-2.2      0.148s   7.293s
  /Users/pmezard/bin/hgdev       0.132s   5.747s

  * hg log -u rnewman -u girard
  /Users/pmezard/bin/hg-2.2      0.146s   7.323s
  /Users/pmezard/bin/hgdev       0.136s  11.096s

  * hg log -l 10
  /Users/pmezard/bin/hg-2.2      0.137s   0.153s
  /Users/pmezard/bin/hgdev       0.128s   0.144s

  * hg log -l 10 -u rnewman
  /Users/pmezard/bin/hg-2.2      0.146s   0.265s
  /Users/pmezard/bin/hgdev       0.133s   0.236s

  * hg log -b GECKO193a2_20100228_RELBRANCH
  /Users/pmezard/bin/hg-2.2      2.332s   6.618s
  /Users/pmezard/bin/hgdev       1.972s   5.543s

  * hg log xulrunner
  /Users/pmezard/bin/hg-2.2      5.829s   5.958s
  /Users/pmezard/bin/hgdev       0.194s   6.017s

  * hg log --follow xulrunner/build.mk
  /Users/pmezard/bin/hg-2.2      0.353s   0.438s
  /Users/pmezard/bin/hgdev       0.394s   0.580s

  * hg log -u girard tools
  /Users/pmezard/bin/hg-2.2      5.853s   6.012s
  /Users/pmezard/bin/hgdev       0.195s   6.030s

  * hg log -b COMM2000_20110314_RELBRANCH --copies
  /Users/pmezard/bin/hg-2.2      2.231s   6.653s
  /Users/pmezard/bin/hgdev       1.897s   5.585s

  * hg log --follow
  /Users/pmezard/bin/hg-2.2      0.137s  14.140s
  /Users/pmezard/bin/hgdev       0.381s  44.246s

  * hg log --follow -r 80000:90000
  /Users/pmezard/bin/hg-2.2      0.127s   1.611s
  /Users/pmezard/bin/hgdev       0.147s   1.847s

  * hg log --follow -r 90000:80000
  /Users/pmezard/bin/hg-2.2      0.130s   1.702s
  /Users/pmezard/bin/hgdev       0.368s   6.106s

  * hg log --follow -r 80000:90000 js/src/jsproxy.cpp
  /Users/pmezard/bin/hg-2.2      0.343s   0.388s
  /Users/pmezard/bin/hgdev       0.437s   0.631s

  * hg log --follow -r 90000:80000 js/src/jsproxy.cpp
  /Users/pmezard/bin/hg-2.2      0.342s   0.389s
  /Users/pmezard/bin/hgdev       0.442s   0.628s
2012-05-08 22:43:44 +02:00
Patrick Mezard
eb2318522a cmdutil: extract increasing_windows() from walkchangerevs()
It will be reused in the revset-based version.
2012-05-08 22:43:44 +02:00
Augie Fackler
c0cf243849 httpclient: omit tests for the client since we don't run them anyway 2012-05-19 09:34:25 -05:00
Augie Fackler
ad6bc369b7 httpclient: update to c5abd358e543 of httpplus 2012-05-18 17:05:17 -05:00
Paul Boddie
5b2a1dc5f5 hgweb: make graph data suitable for template usage
Previously, graph data has been encoded for processing done by
JavaScript code run in the browser, employing simple structures
with implicit member positions. This patch modifies the graph
command to also produce data employing a dictionary-based
structure suitable for use with the templating mechanism, thus
permitting other ways of presenting repository graphs using that
mechanism.

In order to test these changes, the raw theme has been modified
to include templates for graph nodes and edges. In a similar
fashion, themes could employ technologies such as SVG that lend
themselves to templating to produce the graph display. This patch
makes use of a much simpler output representation than SVG in
order to maintain clarity.
2012-05-21 00:20:05 +02:00
Augie Fackler
e8eca68a89 clone: add progress calls to uncompressed code path 2012-05-21 14:25:46 -05:00