Commit Graph

16606 Commits

Author SHA1 Message Date
Brodie Rao
d36ae7f264 localrepo: add branchtip() method for faster single-branch lookups
For the PyPy repo with 744 branches and 843 branch heads, this brings
hg log -r default over NFS from:

   CallCount    Recursive    Total(ms)   Inline(ms) module:lineno(function)
        3249            0      1.3222      1.3222   <open>
        3244            0      0.6211      0.6211   <method 'close' of 'file' objects>
        3243            0      0.0800      0.0800   <method 'read' of 'file' objects>
        3241            0      0.0660      0.0660   <method 'seek' of 'file' objects>
        3905            0      0.0476      0.0476   <zlib.decompress>
        3281            0      2.6756      0.0472   mercurial.changelog:182(read)
       +3281            0      2.5256      0.0453   +mercurial.revlog:881(revision)
       +3276            0      0.0389      0.0196   +mercurial.changelog:28(decodeextra)
       +6562            0      0.0123      0.0123   +<method 'split' of 'str' objects>
       +6562            0      0.0408      0.0073   +mercurial.encoding:61(tolocal)
       +3281            0      0.0054      0.0054   +<method 'index' of 'str' objects>
        3241            0      2.2464      0.0456   mercurial.revlog:818(_loadchunk)
       +3241            0      0.6205      0.6205   +<method 'close' of 'file' objects>
       +3241            0      0.0765      0.0765   +<method 'read' of 'file' objects>
       +3241            0      0.0660      0.0660   +<method 'seek' of 'file' objects>
       +3241            0      1.4209      0.0135   +mercurial.store:374(__call__)
       +3241            0      0.0122      0.0107   +mercurial.revlog:810(_addchunk)
        3281            0      2.5256      0.0453   mercurial.revlog:881(revision)
       +3280            0      0.0175      0.0175   +mercurial.revlog:305(rev)
       +3281            0      2.2819      0.0119   +mercurial.revlog:847(_chunkraw)
       +3281            0      0.0603      0.0083   +mercurial.revlog:945(_checkhash)
       +3281            0      0.0051      0.0051   +mercurial.revlog:349(flags)
       +3281            0      0.0040      0.0040   +<mercurial.mpatch.patches>
       13682            0      0.0479      0.0248   <method 'decode' of 'str' objects>
       +7418            0      0.0228      0.0076   +encodings.utf_8:15(decode)
          +1            0      0.0003      0.0000   +encodings:71(search_function)
        3248            0      1.3995      0.0246   mercurial.scmutil:218(__call__)
       +3248            0      1.3222      1.3222   +<open>
       +3248            0      0.0235      0.0184   +os.path:80(split)
       +3248            0      0.0084      0.0068   +mercurial.scmutil:92(__call__)
Time: real 2.750 secs (user 0.680+0.000 sys 0.360+0.000)

down to:

   CallCount    Recursive    Total(ms)   Inline(ms) module:lineno(function)
          55           31      0.0197      0.0163   <__import__>
          +1            0      0.0006      0.0002   +mercurial.context:8(<module>)
          +1            0      0.0042      0.0001   +mercurial.revlog:12(<module>)
          +1            0      0.0002      0.0001   +mercurial.match:8(<module>)
          +1            0      0.0003      0.0001   +mercurial.dirstate:7(<module>)
          +1            0      0.0057      0.0001   +mercurial.changelog:8(<module>)
           1            0      0.0117      0.0032   mercurial.localrepo:525(_readbranchcache)
        +844            0      0.0015      0.0015   +<binascii.unhexlify>
        +845            0      0.0010      0.0010   +<method 'split' of 'str' objects>
        +843            0      0.0045      0.0009   +mercurial.encoding:61(tolocal)
        +843            0      0.0004      0.0004   +<method 'setdefault' of 'dict' objects>
          +1            0      0.0003      0.0003   +<method 'close' of 'file' objects>
           3            0      0.0029      0.0029   <method 'read' of 'file' objects>
           9            0      0.0018      0.0018   <open>
         990            0      0.0017      0.0017   <binascii.unhexlify>
          53            0      0.0016      0.0016   mercurial.demandimport:43(__init__)
         862            0      0.0015      0.0015   <_codecs.utf_8_decode>
         862            0      0.0037      0.0014   <method 'decode' of 'str' objects>
        +862            0      0.0023      0.0008   +encodings.utf_8:15(decode)
         981            0      0.0011      0.0011   <method 'split' of 'str' objects>
         861            0      0.0046      0.0009   mercurial.encoding:61(tolocal)
        +861            0      0.0037      0.0014   +<method 'decode' of 'str' objects>
         862            0      0.0023      0.0008   encodings.utf_8:15(decode)
        +862            0      0.0015      0.0015   +<_codecs.utf_8_decode>
           4            0      0.0008      0.0008   <method 'close' of 'file' objects>
         179          154      0.0202      0.0004   mercurial.demandimport:83(__getattribute__)
         +36           11      0.0199      0.0003   +mercurial.demandimport:55(_load)
         +72            0      0.0001      0.0001   +mercurial.demandimport:83(__getattribute__)
         +36            0      0.0000      0.0000   +<getattr>
           1            0      0.0015      0.0004   mercurial.tags:148(_readtagcache)
Time: real 0.060 secs (user 0.030+0.000 sys 0.010+0.000)
2012-05-13 14:04:04 +02:00
David Soria Parra
f8942bb230 strip: introduce -B option to remove a bookmark
Add a -B option to remove a bookmark. All revisions are unreachable
from a different head or a different bookmark will be removed too.

This helps with topic branch workflow. You can create a topic branch
and remove it if not needed anymore with hg strip -B topic/xyz.
2012-05-13 16:39:40 +02:00
Joshua Redstone
d70249edef localrepo: strip now incrementally updates the branchheads cache
Destroying history via strip used to invalidate the branchheads cache,
causing it to be regenerated the next time it is read. This is
expensive in large repos. This change converts strip to pass info to
localrepo.destroyed() to enable to it to incrementally update the
cache, improving the performance of strip and other operations that
depend on it (e.g., rebase).

This change also strengthens a bit the integrity checking of the
branchheads cache when it is read, by rejecting the cache if it has
nodes in it that no longer exist.
2012-05-11 10:35:54 -07:00
Patrick Mezard
abc8f672ec phase: remove useless test, olddata is never None 2012-05-12 16:53:36 +02:00
Patrick Mezard
de32ec835b test-rebase-collapse: fix Windows path separator 2012-05-13 14:29:05 +02:00
Matt Mackall
c1a3a77a6b help: tweak keyword format output 2012-05-13 15:26:06 +02:00
Augie Fackler
1fb19c8f86 help: link back to the help topics page from a specific topic page 2012-05-13 05:22:23 -05:00
Augie Fackler
c94e6f7b05 help: add --keyword (-k) for searching help 2012-05-13 06:03:11 -05:00
Augie Fackler
a21ee7f93d help: introduce topicmatch for finding topics matching a keyword 2012-05-13 04:27:08 -05:00
Augie Fackler
52177e47bf extensions.disabled: return {} instead of None no extensions are disabled 2012-05-13 04:06:07 -05:00
David Soria Parra
7d0d5a5a60 merge: respect bookmarks during merge
Bookmarks will behave more like named branches when merge tries to pick
a revision to merge.

Bookmarks now to respect the current bookmarks.  Bookmarks will not
accidentally merged with unnamed heads or other bookmarks. However merge
can pick heads with diverging bookmarks and pick those automatically.

We end up with two cases for picking a revision to merge:
 (1) In case of an current bookmark, merge can pick a branch head that has a
     diverged bookmark
 (2) In case of no current bookmark, merge can pick a branch head that does not
     have a bookmark.
2012-05-13 11:55:42 +02:00
David Soria Parra
2ce902d434 localrepo: introduce bookmarkheads
Similar to branch heads we introduce the notion of bookmarkheads.
Bookmarkheads are changests that are bookmarked with the given bookmark
or a diverged version
2012-05-13 11:54:58 +02:00
David Soria Parra
7ffe2b2eb4 bookmarks: delete divergent bookmarks on merge 2012-05-12 21:28:10 +02:00
Brodie Rao
7f47d4e347 check-code: ignore naked excepts with a "re-raise" comment
This also promotes the naked except check from a warning to an error.
2012-05-13 13:18:06 +02:00
Brodie Rao
391c9b5bf1 check-code: improve detection of naked except clauses 2012-05-13 13:17:50 +02:00
Brodie Rao
46ce54af4d cleanup: replace more naked excepts with more specific ones 2012-05-13 13:17:31 +02:00
Brodie Rao
47a3ca1c2f check-code: promote 80+ character line warning to an error 2012-05-13 13:17:27 +02:00
Patrick Mezard
2cddd7a828 cmdutil: use filectx.cmp() in amend() 2012-05-13 13:19:46 +02:00
Na'Tosha Bard
0af9bc5a7f largefiles: optimize performance when updating (issue3440)
Previously, when updating, cachelfiles was called blindly on all largefiles
in the repository at the revision being updated to, despite the fact that
a list of which largefiles needs to be updated has already been collected.  This
optimization constrains the cachelfiles call to only the largefiles that need
to be updated.

On a repository with about 80 largefiles, updating between two revisions that
only change one largefile goes from approximately 6.7 seconds to 3.3 seconds.
2012-05-12 15:41:27 +02:00
Matt Mackall
05e48d4041 merge with stable 2012-05-13 12:52:24 +02:00
Bryan O'Sullivan
18be3ce9f0 tests: make test-convert-darcs.t happier with darcs 2.8.0 2012-05-13 11:47:55 +02:00
Matt Mackall
732d9d463a merge with i18n 2012-05-13 11:19:48 +02:00
Levi Bard
ff2ee52b29 bookmarks: pull new bookmarks from remote by default (BC) 2012-05-12 17:00:01 +02:00
Wagner Bruna
a0f8506b26 i18n-pt_BR: synchronized with 636975388817 2012-05-08 15:31:14 -03:00
Patrick Mezard
742f6b3850 pure/base85: align exception type/msg on base85.c
brendan mentioned on IRC that b64decode raises a TypeError too, but while the
previous exception type may be better in general, it is much easier to make it
behave like the related C code and changes nothing for mercurial itself.
2012-05-07 21:49:45 +02:00
Matt Mackall
d8dfd80d76 parsers: fix refcount bug on corrupt index
When we encounter a corrupt index, we "fail" the init but our
destructor still gets called. On some systems, this was causing us to
attempt to decref a dangling to self->data.
2012-05-07 15:40:50 -05:00
Patrick Mezard
f49c9eec1a subrepo: do not traceback on .hgsubstate parsing errors
Note that aborting in subrepo.state() prevents "repairing" commands like revert
to be issued. The user will have to edit the .hgsubstate manually (but he
probably had already otherwise this would not be failing). The same behaviour
already happens with invalid .hgsub entries.
2012-05-04 14:19:55 +02:00
Patrick Mezard
a124dced40 subrepo: ignore blank lines in .hgsubstate (issue3424)
Reported by Sebastian Krysmanski <infomail@lordb.de>
2012-05-04 14:19:52 +02:00
hlian
992a6313f9 largefiles: in putlfile, ensure tempfile's directory exists prior to creation
Let R be a repo served by an hg daemon on a machine with an empty largefiles
cache. Pushing a largefiles repo to R will result in a no-such-file-or-directory
OSError because putlfile will attempt to create a temporary file in
R/.hg/largefiles, which does not yet exist.

This patch also adds a regression test for this scenario.
2012-05-04 14:36:40 -04:00
Patrick Mezard
d99bfab018 rebase: allow collapsing branches in place (issue3111)
We allow rebase plus collapse, but not collapse only? I imagine people would
rebase first then collapse once they are sure the rebase is correct and it is
the right time to finish it.

I was reluctant to submit this patch for reasons detailed below, but it
improves rebase --collapse usefulness so much it is worth the ugliness.

The fix is ugly because we should be fixing the collapse code path rather than
the merge. Collapsing by merging changesets repeatedly is inefficient compared
to what commit --amend does: commitctx(), update, strip. The problem with the
latter is, to generate the synthetic changeset, copy records are gathered with
copies.pathcopies(). copies.pathcopies() is still implemented with merging in
mind and discards information like file replaced by the copy of another,
criss-cross copies and so forth. I believe this information should not be lost,
even if we decide not to interpret it fully later, at merge time.

The second issue with improving rebase --collapse is the option should not be
there to begin with. Rebasing and collapsing are orthogonal and a dedicated
command would probably enable a better, simpler ui. We should avoid advertizing
rebase --collapse, but with this fix it becomes the best shipped solution to
collapse changesets.

And for the record, available techniques are:
- revert + commit + strip: lose copies
- mq/qfold: repeated patching() (mostly correct, fragile)
- rebase: repeated merges (mostly correct, fragile)
- collapse: revert + tag rewriting wizardry, lose copies
- histedit: repeated patching() (mostly correct, fragile)
- amend: copies.pathcopies() + commitctx() + update + strip
2012-05-03 15:14:58 +02:00
Adrian Buehlmann
65a9a97e69 diffhelpers: use Py_ssize_t in testhunk()
Eliminates

  mercurial/diffhelpers.c(143) : warning C4244: '=' : conversion from
  'Py_ssize_t' to 'int', possible loss of data
  mercurial/diffhelpers.c(144) : warning C4244: '=' : conversion from
  'Py_ssize_t' to 'int', possible loss of data

when compiling for Windows x64 target using the Microsoft compiler.
2012-05-12 14:00:51 +02:00
Adrian Buehlmann
0a73f19992 diffhelpers: use Py_ssize_t in addlines()
Eliminates

  mercurial/diffhelpers.c(81) : warning C4244: '=' : conversion from
  'Py_ssize_t' to 'int', possible loss of data
  mercurial/diffhelpers.c(82) : warning C4244: '=' : conversion from
  'Py_ssize_t' to 'int', possible loss of data

when compiling for Windows x64 target using the Microsoft compiler.
2012-05-12 13:21:08 +02:00
Adrian Buehlmann
930b763535 diffhelpers: use Py_ssize_t in _fix_newline()
Eliminates

  mercurial/diffhelpers.c(23) : warning C4244: 'initializing' : conversion from
  'Py_ssize_t' to 'int', possible loss of data
  mercurial/diffhelpers.c(26) : warning C4244: 'initializing' : conversion from
  'Py_ssize_t' to 'int', possible loss of data
  mercurial/diffhelpers.c(27) : warning C4244: 'initializing' : conversion from
  'Py_ssize_t' to 'int', possible loss of data
  mercurial/diffhelpers.c(30) : warning C4244: 'initializing' : conversion from
  'Py_ssize_t' to 'int', possible loss of data

when compiling for Windows x64 target using the Microsoft compiler.
2012-05-12 12:07:18 +02:00
Na'Tosha Bard
18869bf5f2 largefiles: add --all-largefiles flag to pull 2012-05-12 11:45:22 +02:00
Na'Tosha Bard
faa9f04319 largefiles: refactor downloading of all largefiles to generic function 2012-05-12 09:59:01 +02:00
Mads Kiilerich
803e845d28 unbundle: move bookmark update outside the lock
abf413aa5fdc introduced updatecurrentbookmark after unbundle, but that path
might end up taking a wlock after lock when writing the bookmarks.
2012-05-12 20:06:04 +02:00
Brodie Rao
a706d64a2c cleanup: replace naked excepts with except Exception: ... 2012-05-12 16:02:46 +02:00
Brodie Rao
c577fac135 cleanup: replace naked excepts with more specific ones 2012-05-12 16:02:45 +02:00
Brodie Rao
92158e04de cleanup: "raise SomeException()" -> "raise SomeException" 2012-05-12 16:00:58 +02:00
Brodie Rao
a7ef0a0cc5 cleanup: "not x in y" -> "x not in y" 2012-05-12 16:00:57 +02:00
Brodie Rao
2db5d441ca cleanup: replace hasattr() usage with getattr() in hghave 2012-05-12 16:00:53 +02:00
Brodie Rao
dd09ae96e9 cleanup: "x != None" -> "x is not None" 2012-05-12 15:56:23 +02:00
Brodie Rao
d6a6abf2b0 cleanup: eradicate long lines 2012-05-12 15:54:54 +02:00
Martin Geisler
1e5a14b6b5 progress: fix indentation 2012-05-11 18:41:04 +02:00
Martin Geisler
194d85c712 test-progress: fix whitespace typo 2012-05-11 15:13:13 +02:00
Matt Mackall
4d12f82b66 merge with stable 2012-05-12 13:20:26 +02:00
Bryan O'Sullivan
058dfb801d revlog: speed up prefix matching against nodes
The radix tree already contains all the information we need to
determine whether a short string is an unambiguous node identifier.
We now make use of this information.

In a kernel tree, this improves the performance of
"hg log -q -r24bf01de75" from 0.27 seconds to 0.06.
2012-05-12 10:55:08 +02:00
Bryan O'Sullivan
f29187cd15 parsers: ensure that nullid is always present in the radix tree 2012-05-12 10:55:08 +02:00
Bryan O'Sullivan
4fe1bcbdb1 parsers: allow hex keys 2012-05-12 10:55:07 +02:00
Matt Mackall
8420ca3aee merge with stable 2012-05-12 12:23:49 +02:00