Commit Graph

16475 Commits

Author SHA1 Message Date
Matt Mackall
567d3a0049 tags: defer tag validation until repo.tags() is called
Before, we were validating all tags for any tag operation, which meant
building a (nearly) full node->tag lookup tree for most operations.
2012-04-06 15:16:30 -05:00
Bryan O'Sullivan
774e52cd41 parsers: fix a memleak, and add a clearcaches method to the index
This change also fixes a nasty memory leak: previously, self->caches
was not being freed.

The new clearcaches method lets us benchmark with finer granularity,
as it lets us separate the cost of loading a revlog index from those
of populating and accessing the cache data structures.
2012-04-06 00:28:36 -07:00
FUJIWARA Katsunori
8ef345c7b4 mq: use list of already known target files instead of matching object for diff
'hg qnew' passes matching object to 'patch.diff()' to specify target
filenames, and it causes 'dirstate.walk()' via 'repo.status()' in
'patch.diff()'.

but target files are already known before 'patch.diff()' invocation.

to avoid useless 'dirstate.walk()' invocation, this patch uses
'changes' argument to pass already known target files to
'patch.diff()' instead of 'match' argument.

'changes' argument of 'patch.diff()' should have lists for modified,
added and removed files separately, so this patch saves status of
'.hgsubstate' before commit, and put it into appropriate list in
'changes'.
2012-04-05 23:52:55 +09:00
FUJIWARA Katsunori
7902b7f157 mq: use exact matching in the second dirstate walking for efficiency of 'qnew'
'hg qnew' with pattern/-I/-X creates matching object with them, and
uses it twice for 'dirstate.walk()': via 'repo.status()' and
'repo.commit()'.

this may cause full manifest scan in the second 'dirstate.walk()',
even though mq already knows complete target filenames at the first
'dirstate.walk()'.

this patch creates exact matching object also in this case, and use it
at 'repo.commit()' invocation to avoid full manifest scan in the
second 'dirstate.walk()'.

even though 'inclsubs' is added to 'pats' for original matching
object, it is also passed to exact matching object, because
subrepositories are deleted from result of 'dirstate.walk()' at the
end of it.
2012-04-05 23:52:06 +09:00
Bryan O'Sullivan
849e7f15fd parsers: incrementally parse the revlog index in C
We only parse entries in a revlog index file when they are actually
needed, and cache them when first requested.

This makes a huge difference to performance on large revlogs when
accessing the tip revision or performing a handful of numeric lookups
(very common cases).  For instance, "hg --time tip --template {node}"
on a tree with 300,000 revs takes 0.15 before, 0.02 after.

Even for revlog-intensive operations (e.g. running "hg log" to
completion), the lazy approach is about 1% faster than the eager
parse_index2.
2012-04-05 13:00:35 -07:00
Benoit Allard
ed90b14694 protocol: Add the stream-preferred capability
This makes the client use the uncompressed protocol.
2012-04-04 00:00:47 +02:00
Matteo Capobianco
8305e8d305 templates/filters: extracting the user portion of an email address
Currently, the 'user' filter is using util.shortuser(text) (which clearly
doesn't extract only the user portion of an email address, even though the
help text says it does).

The new 'emailuser' filter uses the new util.emailuser(text) function which,
instead, does exactly that.

The help text on the 'user' filter has been modified accordingly.
2012-03-28 16:06:20 +02:00
Patrick Mezard
83515678f4 patch: remove useless variable assignment 2012-04-05 19:23:04 +02:00
Thomas Arendsen Hein
dd805a8d81 merge with stable 2012-04-04 11:19:09 +02:00
Thomas Arendsen Hein
222d56e619 merge with stable 2012-04-03 22:02:04 +02:00
Thomas Arendsen Hein
a076708e7b merge with stable 2012-04-03 21:02:00 +02:00
Matt Mackall
0dce04d2d0 config: discard UTF-8 BOM if found 2012-04-03 11:35:04 -05:00
Matt Mackall
90a622f2a7 merge with stable 2012-04-02 17:02:50 -05:00
Matt Mackall
8bb041e398 tests: shorten post-test sleeps
This helps expose races
2012-04-02 17:02:03 -05:00
Matt Mackall
c6477b03be merge with stable 2012-04-02 16:09:29 -05:00
Matt Mackall
441e9eee4e merge with stable 2012-04-01 15:57:04 -05:00
Matt Mackall
7f19fb4f8f tests: fix one more sed -i 2012-04-01 15:35:12 -05:00
Matt Mackall
309ca70823 merge stable 2012-04-01 15:34:22 -05:00
Matt Mackall
4325ad525f tests: remove sed -i from test-record 2012-04-01 13:59:11 -05:00
Augie Fackler
dfc3978483 zsh completion: fix error in qfinish completions from 584f7a076523
The actual flag is --applied, not --all.
2012-03-31 15:39:44 -05:00
Matt Mackall
73319d495a merge with stable 2012-03-31 14:05:10 -05:00
Matt Mackall
58dccf8b84 record: fix up test issues
sed on BSD requires an arg to -i
sed failing exposed an uninitialized variable issue
2012-03-31 14:04:39 -05:00
Matt Mackall
36e8e28670 merge with stable 2012-03-31 11:19:09 -05:00
A. S. Budden
285680e0f0 record: allow splitting of hunks by manually editing patches
It is possible that unrelated changes in a file are on sequential lines.  The
current record extension does not allow these to be committed independently.

An example use case for this is in software development for deeply embedded
real-time systems.  In these environments, it is not always possible to use a
debugger (due to time-constraints) and hence inline UART-based printing is
often used.  When fixing a bug in a module, it is often convenient to add a
large number of 'printf's (linked to the UART via a custom fputc) to the module
in order to work out what is going wrong.  printf is a very slow function (and
also variadic so somewhat frowned upon by the MISRA standard) and hence it is
highly undesirable to commit these lines to the repository.  If only a partial
fix is implemented, however, it is desirable to commit the fix without deleting
all of the printf lines.  This is also simplifies removal of the printf lines
as once the final fix is committed, 'hg revert' does the rest.  It is likely
that the printf lines will be very near the actual fix, so being able to split
the hunk is very useful in this case.

There were two alternatives I considered for the user interface.  One was to
manually edit the patch, the other to allow a hunk to be split into individual
lines for consideration.  The latter option would require a significant
refactor of the record module and is less flexible.  While the former is
potentially more complicated to use, this is a feature that is likely to only
be used in certain exceptional cases (such as the use case proposed above) and
hence I felt that the complexity would not be a considerable issue.

I've also written a follow-up patch that refactors the 'prompt' code to base
everything on the choices variable.  This tidies up and clarifies the code a
bit (removes constructs like 'if ret == 7' and removes the 'e' option from the
file scope options as it's not relevant there.  It's not really a necessity, so
I've excluded it from this submission for now, but I can send it separately if
there's a desire and it's on bitbucket (see below) in the meantime.

Possible future improvements include:

* Tidying up the 'prompt' code to base everything on the choices variable.
  This would allow entries to be removed from the prompt as currently 'e' is
  offered even for entire file patches, which is currently unsupported.
* Allowing the entire file (or even multi-file) patch to be edited manually:
  this would require quite a large refactor without much benefit, so I decided
  to exclude it from the initial submission.
* Allow the option to retry if a patch fails to apply (this is what Git does).
  This would require quite a bit of refactoring given the current 'hg record'
  implementation, so it's debatable whether it's worth it.

Output is similar to existing record user interface except that an additional
option ('e') exists to allow manual editing of the patch.  This opens the
user's configured editor with the patch.  A comment is added to the bottom of
the patch explaining what to do (based on Git's one).

A large proportion of the changeset is test-case changes to update the options
reported by record (Ynesfdaq? instead of Ynsfdaq?).  Functional changes are in
record.py and there are some new test cases in test-record.t.
2012-03-30 22:08:46 +01:00
Matt Mackall
5a705b3a5d merge with stable 2012-03-30 14:35:06 -05:00
Patrick Mezard
c3cb584665 graphlog: handle old-style --rev values
--rev options cannot be merged into a single revset because we do not know if
they are valid revset or old-style revision specifications, like 'foo-bar'
tags. Instead, a base revision set is generated with scmutil.revrange() then
filtered with the revset built from log options. It also fixes incorrect or
hostile expressions passed in --rev.
2012-03-29 22:42:03 +02:00
Patrick Mezard
ac1ed61cb2 test-glog: pretty print revset expressions 2012-03-29 17:13:23 +02:00
Patrick Mezard
4b4652fe4f graphlog: improve --only-branch handling
The previous code was correct for command line as opts always contains the
default empty lists for --branch and --only-branch options. But calling
graphlog.revset() directly with only --only-branch set would leave it
unprocessed.
2012-03-29 16:55:08 +02:00
Takumi IINO
3b2329f4cd tests: skip test-lfconvert.t if not support symblic link
Windows not support symbolic link. but test-lfconvert.t
execute 'ln -s' command.

@@ -51,8 +51,6 @@
   skipping incorrectly formatted tag IncorrectlyFormattedTag!
   skipping incorrectly formatted id invalidhash
   no mapping for id 0123456789abcdef
-  abort: renamed/copied largefile large3 becomes symlink
-  [255]
   $ cd bigfile-repo
   $ hg strip --no-backup 2
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved

ERROR: test-lfconvert.t output changed
2012-03-29 22:16:56 +09:00
Matt Mackall
98ed4dc5e9 perf: node lookup 2012-03-30 14:16:06 -05:00
Paul Boddie
0e0c036052 hgweb: add block numbers to diff regions and related links
The changeset view may show several diff regions, one per file, and this patch
numbers each of them so that links produced by the filenodelink fragment can
reference each diff region produced by the diffblock fragment through the use
of the blockno variable made available to both of them. This permits
navigation to diff regions on the changeset page from the file list, and
where the :target pseudo-class is supported in browsers, permits selective
presentation of diffs, showing one at a time instead of potentially many in
what would otherwise be a very long page that is difficult to navigate.
2012-03-23 01:31:31 +01:00
Angel Ezquerra
2da9b90b7f patchbomb: add --body flag to send patches as inline message body text
There is currently no way to make patchbomb include patches both as attachments
and as inline text. This would be quite convenient when sending patches to
people who use web email clients (e.g. gmail) which often mangle the patches,
making them hard to apply.

The default behavior of the email command is unchanged. However it is now
possible to use the --body flag _in addition_ to the -i or -a flags, in which
case the patchbomb emails will contain the patch as inline body text and as an
attachment.

A new test has been added to test-patchbomb.t ("test attach for single
patch"), based on the existing test called "test attach for single patch" test.
2012-03-21 06:45:07 +01:00
Greg Ward
66a1ddf402 shrink-revlog: make check-code happier
There's still a naked 'except:' clause, but I'm not sure how to fix it
(what exception is it expecting?). This just fixes line length.
2012-03-28 15:25:20 -04:00
Greg Ward
05fadec600 shrink-revlog: make pyflakes happy 2012-03-28 15:15:15 -04:00
Angel Ezquerra
a67f0ff376 revert: move bulk of revert command from commands to cmdutil
This revision has no functionality change. The code on the original
commands.revert() function has been split. The first part of the
original code, which checks that the command inputs are correct
remains in commands.revert(). The rest of the function, which performs
the actual revert operation has been moved into cmdutil.revert().

The purpose of this change is to make it easier to perform a revert
operation, from other parts of the code. This may be used to implement
reverting of subrepos.
2012-03-28 11:42:17 +02:00
Matt Mackall
2cf26ea8f0 merge with stable 2012-03-27 16:17:46 -05:00
Matt Mackall
7f2dc15daf merge with stable 2012-03-27 14:37:17 -05:00
Matt Mackall
9b533bc599 merge with stable 2012-03-26 16:42:53 -05:00
Matt Mackall
6d3a783a57 merge: fix unknown file merge detection for case-folding systems
This was triggering some test failures on Mac.
2012-03-26 16:41:54 -05:00
Pierre-Yves David
a6a8d8d05e qfinish: comply with the phases.new-commit option in secret mode (issue3335)
In secret mode qfinished changeset were move to the draft phase in all case[1]
without regard to phases.new-commit value

This changeset ensure qfinish does not automatically promote a changeset
further than the phases.new-commit value.

Note: This may also result in qfinished changeset made public if
phases.new-commit is set to public.

[1] "In all case" where parent have a compatible phase. Qfinish keep never
    altering phases of changeset not involved in the qfinish.
2012-03-24 12:06:49 +01:00
Matt Mackall
6c58e9cb98 rename: handle case-changing (issue1717) 2012-03-23 11:47:27 -05:00
Matt Mackall
39c1d7334a merge with stable 2012-03-22 17:08:05 -05:00
Matt Mackall
73fcdcd76c strip: ignore -n (issue3326) (BC)
-n could be confused for --dry-run by foolhardy users, resulting in
 permanent data loss.

As leaving a backup when none was requested is significantly less
disastrous, the short option is silently ignored. Old scripts continue
to work, users only get lightly burned.
2012-03-22 17:07:39 -05:00
Matt Mackall
8fac36f6df aliases: use empty string for missing position parameters (issue3331) 2012-03-22 17:07:39 -05:00
Matt Mackall
369755dc10 encoding: tune fast-path of tolocal a bit 2012-03-22 16:54:46 -05:00
FUJIWARA Katsunori
a3e4d70aa4 largefiles: use 'dirstate.dirs()' for 'directory pattern' relation check
original implementation queries whether specified pattern is related
or not to largefiles in target context by 'dirstate.__contains__()'.

but this can't recognize 'directory pattern' correctly, so this patch
uses 'dirstate.dirs()' for it.

this patch uses dirstate instead of lfdirstate in 'working' route
(second patch hunk for 'hgext/largefiles/reposetup.py'), because
'dirs()' information may be already built for dirstate but not yet for
lfdirstate at this point. this prevents lfdirstate from building up
and having 'dirs()' information.
2012-03-22 23:58:47 +09:00
FUJIWARA Katsunori
74e7c5bd04 largefiles: suppress unexpected warning of 'hg status' for removed files
original implementation queries whether specified pattern is related
or not to largefiles, to target context.

but changectx/workingctx returns False about relationship with files
marked as removed.

So, 'hg status' with 'file pattern' for removed file shows unexpected
warning message in below process:

    1. 'tostandin()' returns non-STANDIN filename for removed file,
       because changectx/workingctx returns False about relationship
       with it

    2. 'match.files()' contains non-STANDIN filename, which is already
       removed from working directory

    3. 'dirstate.walk()' invoked via 'localrepository.status()' treats
       non-STANDIN filename as bad filename, because there is no entry
       for it in dirstate: only STANDIN is managed in dirstate

    4. 'dirstate.walk()' invokes 'match.bad()', which is defined in
       'localrepository.status()' as 'bad()'

    5. 'bad()' shows warning message for non-STANDIN, because it is
       not related to source context: only STANDIN is related to it

this patch queries to dirstate instead of changectxt/workingctx,
because dirstate returns expected result for removed files.

'match.files()' is used by 'localrepository.status()' only in
'working' case, so this patched code also works correctly in
non-'working' case.
2012-03-22 23:58:47 +09:00
Matt Mackall
352b46cf1d rebase: properly calculate descendant set when aborting (issue3332)
Checking for descendants of target being public was also wrong.
2012-03-22 17:47:00 -05:00
Greg Ward
f3454837e5 test-gpg: make sure gpg does not modify the trustdb.gpg file
Tests really should not modify files in the Mercurial working dir
where they ran from! I suspect that trustdb.gpg is now old enough that
GPG thinks it should update it automatically. Suppress that feature
with --no-auto-check-trustdb.
2012-03-21 22:16:12 -04:00
Matt Mackall
a845d7fbee tests: remove case-folding false positive 2012-03-27 13:57:54 -05:00