Commit Graph

9061 Commits

Author SHA1 Message Date
Siddharth Agarwal
e006a50c9b test-lock.py: add a lock wrapper that allows faking the PID
This will be used in upcoming patches to create locks that appear as if they're
being created by child processes.
2015-09-24 20:22:59 -07:00
Siddharth Agarwal
14584f8c1d test-lock.py: move temp dir generation to testcase
In upcoming patches we'll want to create multiple test state objects with a
common test directory.
2015-09-24 19:52:34 -07:00
Siddharth Agarwal
abec122d89 test-lock.py: copy-edit assertions about file existing
Before: expected lock to exists but actually did not exists
After:  expected lock to exist but actually did not exist
2015-09-24 17:33:13 -07:00
Yuya Nishihara
ae50cd8035 tests: suppress verbose output of svn transaction
Subversion 1.9 shows more verbose messages than 1.8 and the tests fail
because of them. These outputs are not important in our tests, so let's
suppress them by -q or grep -v.
2015-09-26 15:20:32 +09:00
Yuya Nishihara
dac7167e8f help: include parens in DEPRECATED/EXPERIMENTAL keywords
In some languages that have no caps, "DEPRECATED" and "deprecated" can be
translated to the same byte sequence. So it is too wild to exclude messages
by _("DEPRECATED").
2015-09-26 11:38:39 +09:00
Jordi Gutiérrez Hermoso
cce05f8f6d phases: return zero for no-op operations (issue4751) (BC)
It is rather unhelpful to return 1 if there were no changes because
the request matches the current state of phases. So we just undo that.
2015-09-14 19:25:34 -04:00
Jordi Gutiérrez Hermoso
8a7abebe42 dispatch: don't stack trace on commands like hg .log
This used to stack trace because it raised a util.Abort which wasn't
handled in this block. We now handle it. Additionally, we error out
earlier instead of plodding on and showing the "log" entry of the
plain `hg help` output.
2015-09-25 11:16:20 -04:00
Anton Shestakov
e295b5a51b gitweb, monoblue: port highlighting linked lines from paper
This is adapted from a9c9f5ef6abf, 38b0132204f4 and 1555d017cac7.
2015-09-25 12:38:20 +08:00
Anton Shestakov
9643ca35f2 gitweb, monoblue: fix vertical align of spans in .sourcelines
Empty lines in file view could produce an inexplicable margin before the next
line (most noticeable in browsers on webkit/blink engine). That was making
empty lines seem taller than the rest.

Instead of using default vertical align, let's set it to 'top'.

This issue is actually present in paper, and only recently got into gitweb
(0609781075c1) and monoblue (b7a7757577fb). There's a bit more to it in paper,
so that will be dealt with in a future patch.

Recipe to see live: preferably using a webkit/blink browser, such as chromium,
browse a file with empty lines, e.g. https://selenic.com/hg/file/3.5/README#l8
Selecting a block of text that includes empty lines will reveal white "breaks"
in the selection. Highlighted line (#l8) also shows such a break below itself.
2015-09-25 03:02:38 +08:00
timeless@mozdev.org
e4c8525ba7 rebase: avoid losing branch commits with --keepbranch (issue4835) 2015-09-24 17:51:05 -04:00
timeless@mozdev.org
776539bcbf resolve: consistently describe re-merge + unresolved 2015-09-25 03:51:46 -04:00
liscju
c4c7beba44 mercurial: add debugextensions command (issue4676)
Add debugextensions command to help users debug their extension
problems. If there are no extensions command prints nothing,
otherwise it prints names of extension modules. If quiet or
verbose option is not specified it prints(after extensions name)
last version of mercurial in which given module was tested for
non internal modules or not tested with user mercurial version.

If verbose is specified it prints following information for every
extension: extension name, import source, testedwith and buglink
information.

Extensions are printed sorted by extension name.
2015-09-10 16:53:07 +02:00
Laurent Charignon
1cb3086e23 rebase: don't rebase obsolete commit whose successor is already rebased
This patch avoids unnecessary conflicts to resolve during rebase for the users
of changeset evolution.

This patch modifies rebase to skip obsolete commits if they are being rebased on
their successors.
It introduces a new rebase state 'revprecursor' for these revisions that are
being skipped and a new message to inform the user of what is happening.
This feature is gated behind the config flag experimental.rebaseskipobsolete

When an obsolete commit is skipped, the output is:
not rebasing 14:9ad579b4a5de "I", already in destination as 17:fc37a630c901 "K"
2015-09-14 17:31:48 -07:00
Siddharth Agarwal
0edaba580a lock: move acquirefn call to inside the lock
We're going to need to call it again as part of reinitialization after a
subprocess inherits the lock.
2015-09-22 14:09:42 -07:00
Yuya Nishihara
d7b6a95763 hgweb: overwrite cwd to resolve file patterns relative to repo (issue4568)
It's useless to handle file patterns as relative to the cwd of the server
process. The only sensible way in hgweb is to resolve paths relative to the
repository root.

It seems dirstate.getcwd() isn't used to get a real file path, so this patch
won't cause problem.
2015-09-20 20:11:31 +09:00
Siddharth Agarwal
3896b66e0f tests: add unit tests for locking code
We're going to make significant changes to lock behavior soon.
2015-09-17 15:38:00 -07:00
Anton Shestakov
de245a8121 gitweb: port code selection without line numbers from paper
This is adapted from a46863946982 and 8d7bff75072d.

It also fixes issue4790 in gitweb; tab characters now have meaningful width on
the modified pages (file view, file diff, changeset).
2015-09-22 02:09:10 +08:00
Pierre-Yves David
6705b17abd bookmark: do not crash when active bookmark is forward and --date is used
The logic that decides where to update according to the active bookmark
location (when not on ".") was setting the rev to update to before we process
--date.  This lead to --date processing aborting because of duplicated
specification.

We reorder the two pieces of code and add a test for this.
2015-09-17 16:08:10 -07:00
Pierre-Yves David
885e11c51d bookmark: actually test update behavior in both cases
The test claimed to test pull --update behaved the same way as pull + update,
but the behavior of pull + update was never tested.

We now test both.
2015-09-17 17:17:54 -07:00
Anton Shestakov
4de10bfe5d coal: reuse style-paper.css and use a separate css file for visual tweaks
To remove another big chunk of duplication from coal hgweb style, we can move
all visual tweaks to style-extra-coal.css and include it together with
style-paper.css.
2015-09-18 14:03:32 +08:00
Anton Shestakov
b1908a7d13 monoblue: split a long line in filelogentry template
The whole td has a nowrap class, which disallows breaking the line, so it's not
required to use non-breakable spaces.
2015-09-18 14:23:44 +08:00
Yuya Nishihara
b2d79071df readbundle: fix typo of None compression
The test simulates pre-53c48b25631a hgweb that sends "unbundle" capability
with no argument.
2015-09-18 21:32:43 +09:00
Pierre-Yves David
4595c06fb1 traceback: allow providing a local support contact point
The extensions blaming code is fine for casual users but pretty terrible for
corporate environments that can deploy a large amount of extensions to
unsuspecting users. Reports will likely blame a random "innocent" extension (in
our case crecord) and the hint in the message will triggers endless debug
attempts from the user.

We introduce a "ui.supportcontact" option that allow such big company to redirect
their users to their own support desk. This disables all extensions blaming and
just point people to the local support in all cases.
2015-09-11 12:45:19 -07:00
timeless@mozdev.org
076fde20cc test-i18n: always run non gettext tests 2015-09-17 07:31:07 -04:00
Yuya Nishihara
a3529f51c1 localrepo: refresh filecache stats only if transaction finished successfully
If commit is aborted by pretxncommit hook, in-memory changelog and manifest
have entries that would be added. So they must be discarded on invalidate().

But the mechanism introduced by 071f71da2fe2 doesn't handle this case well.
It tries to mitigate the penalty of invalidate() by marking in-memory cache
as "clean" on unlock assuming that they are identical to the stored data.
But this assumption is wrong if stored data are rolled back by tr.abort().

This patch moves the hook to post-close action so that it will never be
triggered on abort.

This bug was originally reported to thg, which is only reproducible in
command-server process on unix, evolve disabled.

https://bitbucket.org/tortoisehg/thg/issues/4285/
2015-09-15 00:32:39 +09:00
Anton Shestakov
7e01618c4d highlight: add highlightfiles config option which takes a fileset (issue3005)
Highlight extension lacked a way to limit files by size, by extension, and/or
by any other part of file path. A good solution would be to use a fileset,
since it can check file path, extension and size (and more) in one expression.
So this change introduces such an option, highlighfiles, which takes a fileset
and on each request decides if the requested file should be highlighted.

The default "size('<5M')" is, in a way, suggested in issue3005.

checkfctx() limits the amount of work to just one file (subset kwarg in
fileset.matchctx()).

Monkey-patching works around issue4568, otherwise using filesets here while
running hgweb in directory mode would say, for example, "Abort: **.py not under
root", but this fix is very local and probably far from ideal. I suspect there
to be a way to fix this for the whole hgweb and resolve the issue, but I don't
know how to do it.
2015-09-16 22:30:36 +08:00
Gregory Szorc
4e3c6d9b7a hgweb: consume generator inside context manager (issue4756)
If code inside a context manager returns a generator, the context
manager exits before the generator is iterated.

hgweb was using a context manager to control thread safe access to a
localrepository instance. But it was returning a generator, so there was
a race condition between a previous request streaming a response to the
client and a new request obtaining the released but in use repository.
By iterating the generator inside the context manager, we ensure we
don't release the repo instance until after the response has finished.

With this change, hgweb finally appears to have full localrepository
isolation between threads. I can no longer reproduce the 2 exceptions
reported in issue4756.

test-hgweb-non-interactive.t has been modified to consume the output
of calling into a WSGI application. Without this, execution of the WSGI
application stalls because of the added yield statement.
2015-09-12 12:16:39 -07:00
Augie Fackler
57b1966770 histedit: use one editor when multiple folds happen in a row (issue3524) (BC)
This was the first ever feature request for histedit, originally filed
back on April 4, 2009. Finally fixed.

In the future we'll probably want to make it possible for other
preprocessing steps to be added to the list, but for now we're
skipping that because it's unclear what the API should look like
without a proposed consumer.
2015-08-27 14:46:26 -04:00
Anton Shestakov
d1c17dc442 hgweb: replace .sourcelast with .bottomline that does the same
In paper and Coal, basically, div.sourcelast was only used to make a 1px border
on the bottom of file source view (and only there). It's better to use
bottomline class, that also exists for the same purpose (visually), but is used
more widely and works without needing an empty <div>.
2015-09-14 18:41:09 +08:00
Anton Shestakov
166a086d20 coal: copy newer things from paper
Basically, coal style in hgweb is intended to be functionally equivalent (just
different in style) to paper, and does this by reusing almost all templates
from paper (except header.tmpl, where it specifies a different css file). Looks
like everybody forgot this and so many improvements to paper templates, that
should've also made it into coal, were often only half-done there (usually
thanks to template reuse). Let's fix this by bulk-copying missing things from
paper/map and style-paper.css to coal/map and style-coal.css.

There were many improvements to paper that didn't touch coal, and that makes it
hard to untangle the code and split this patch into many, but here are some of
the changes (paper-only), that now get into coal:

a9c9f5ef6abf - hgweb: color line which is linked to in file source view
1555d017cac7 - hgweb: highlight line which is linked to at annotate view
a46863946982 - hgweb: code selection without line numbers in file source view
636594df4244 - hgweb: add line wrapping switch to file source view
cc6bee069ce6 - hgweb: use css margin instead of empty <p> before diffstat table

It also fixes line anchor in annotateline template (#42 vs #l42).
2015-09-13 21:01:34 +08:00
timeless@mozdev.org
36e75d4956 test-bad-extension: reduce dependencies on other things
test-bad-extension would jitter if the format of the first line
of hg help changed, which isn't relevant to its goal.
2015-09-10 19:45:46 -04:00
timeless@mozdev.org
a14fb0ee13 help: fix help argument parsing and documentation
support combining -c and -e

previously -k was misdocumented:
 * the first line didn't mention it
 * the help half implied you could do help -k keyword topic

with these changes, -k just changes the search method

support -c and -e for -k searches
2015-09-10 20:22:37 -04:00
timeless@mozdev.org
ea3920eaa0 minirst: establish leveling for nested definitions 2015-09-10 10:48:20 -04:00
Yuya Nishihara
80896f8bec templater: switch ctx of list expression to rev of revset() (BC)
Because revset() function generates a list of revisions, it seems sensible
to switch the ctx as well where a list expression will be evaluated. I think
"{revset(...) % "..."}" expression wasn't considered well when it was
introduced at 45e0e191755f.
2015-09-12 00:21:41 +09:00
Yuya Nishihara
375ffa2a98 fileset: handle error of string unescaping 2015-09-10 23:32:36 +09:00
Yuya Nishihara
b5477ed9b3 revset: handle error of string unescaping 2015-09-10 23:29:55 +09:00
Matt Harbison
99ffdaafef extdiff: enable -I/-X with --patch
Not sure how useful this really is, but it's trivial to add and ignoring the
existing arguments supported seems like a bad UI.
2015-09-09 22:27:48 -04:00
Matt Harbison
c3b634a166 extdiff: add a --patch argument for diffing changeset deltas
One of the things I missed the most when transitioning from versioned MQ to
evolve was the loss of being able to check that rebase conflicts were properly
resolved by:

  $ hg ci --mq -m "before"
  $ hg rebase -s qbase -d tip
  $ hg bcompare --mq

The old csets stay in the tree with evolve, but a straight diff includes all of
the other changes that were pulled in, obscuring the code that was rebased.
Diffing deltas can be confusing, but unless radical changes were made during the
resolve, it is very clear when individual hunks are added, dropped or modified.
Unlike the MQ technique, this can only compare a single pair of csets/patches at
a time.  Like the MQ method, this also highlights changes in the commit comment
and other metadata.

I originally tried monkey patching from the evolve extension, but that is too
complicated given that it depends on the order the two different extensions are
loaded.  This functionality is also useful when comparing grafts however, so
implementing it in the core is more than just convenience.

The --change argument doesn't make much sense for this, but it isn't harmful so
I didn't bother blocking it.  The -I/-X options are ignored because of a
limitation of cmdutil.export().  We'll fix that next.
2015-09-09 21:07:38 -04:00
Jordi Gutiérrez Hermoso
ccabd73556 filemerge: add non-interactive :merge-local and :merge-other
There are two non-interactive internal merge tools, :other and :local,
but they don't really merge, they just pick all changes from the local
or other version of the file. In some situations, it is known that we
want a merge and also know that all merge conflicts should be resolved
in one direction. Although external merge tools can do this, sometimes
it can be convenient to do so from within hg, without invoking a merge
tool. These new :merge-local and :merge-other tools can do just that.
2015-09-10 09:41:11 -04:00
Augie Fackler
dd2db8e9c7 test-convert-git: work around output format changes in git
git version 2.4.3:
--- /home/augie/hg/tests/test-convert-git.t
+++ /home/augie/hg/tests/test-convert-git.t.err
@@ -659,7 +659,7 @@
   $ touch a && git add a && git commit -am "commit a"
   [master (root-commit) 8ae5f69] commit a
    Author: nottest <test@example.org>
    1 file changed, 0 insertions(+), 0 deletions(-)
    create mode 100644 a
   $ cd ..
   $ git clone git-repo7 git-repo7-client

git version 1.7.9.5:
--- /home/augie/hg/tests/test-convert-git.t
+++ /home/augie/hg/tests/test-convert-git.t.err
@@ -659,7 +659,7 @@
   $ touch a && git add a && git commit -am "commit a"
   [master (root-commit) 8ae5f69] commit a
    Author: nottest <test@example.org>
-   1 file changed, 0 insertions(+), 0 deletions(-)
+   0 files changed
    create mode 100644 a
   $ cd ..
   $ git clone git-repo7 git-repo7-client

I don't know when this changed in git and am too lazy to try and
bisect it, so just work around the change.
2015-08-17 19:03:58 -04:00
Matt Mackall
5b498724ca templater: add new docheader/footer components for XML (issue4135)
The existing header/footer components were templated per-changeset,
and thus couldn't be correctly printed for an empty log
2015-08-26 16:27:14 -05:00
Gregory Szorc
39247b40e9 hgweb: use separate repo instances per thread
Before this change, multiple threads/requests could share a
localrepository instance. This meant that all of localrepository needed
to be thread safe. Many bugs have been reported telling us that
localrepository isn't actually thread safe.

While making localrepository thread safe is a noble cause, it is a lot
of work. And there is little gain from doing so. Due to Python's GIL,
only 1 thread may be processing Python code at a time. The benefits
to multi-threaded servers are marginal.

Thread safety would be a lot of work for little gain. So, we're not
going to even attempt it.

This patch establishes a pool of repos in hgweb. When a request arrives,
we obtain the most recently used repository from the pool or create a
new one if none is available. When the request has finished, we put that
repo back in the pool.

We start with a pool size of 1. For servers using a single thread, the
pool will only ever be of size 1. For multi-threaded servers, the pool
size will grow to the max number of simultaneous requests the server
processes.

No logic for pruning the pool has been implemented. We assume server
operators either limit the number of threads to something they can
handle or restart the Mercurial process after a certain amount of
requests or time has passed.
2015-08-22 18:43:24 -07:00
Gregory Szorc
83818c1fca hg: establish a cache for localrepository instances
hgweb contained code for determining whether a cached localrepository
instance was up to date. This code was way too low-level to be in
hgweb.

This functionality has been moved to a new "cachedlocalrepo" class
in hg.py. The code has been changed slightly to facilitate use
inside a class. hgweb has been refactored to use the new API.

As part of this refactor, hgweb.repo no longer exists! We're very close
to using a distinct repo instance per thread.

The new cache records state when it is created. This intelligence
prevents an extra localrepository from being created on the first
hgweb request. This is why some redundant output from test-extension.t
has gone away.
2015-08-22 18:54:34 -07:00
Matt Mackall
b57f682965 templater: create string unescape helper (issue4798)
This gives us a unified place to do error-handling of string-escaping
syntax errors
2015-09-09 14:43:45 -07:00
Durham Goode
74879ebad9 profiling: allow logging profile to the blackbox
This allows specifying '--config profiling.output=blackbox' which will log the
profile output to the blackbox (if enabled). This is useful for doing profiling
on the server since it allows us to record the command, it's result, any
exceptions, and it's profile, all in one spot.  And we get log rotation for
free.
2015-09-08 11:39:52 -07:00
Gregory Szorc
7c62588e37 ui: change default path fallback mechanism (issue4796)
The previous paths API code always fell back to the default path. This
was wrong because if a requested path doesn't exist, that should error.
Only if no path was requested should we fall back to the default.

As part of implementing the test case for issue 4796, it was discovered
that the "repository does not exist" error message raised by
localrepository.__init__ wasn't being seen because the paths API
validates paths before localrepository.__init__ was being called.
The exception and error message from localrepository.__init__ has
been introduced to getpath(). This necessitated rewriting
expandpath() both to catch the exception and to have proper
default fallback.

This code is more complicated than I'd like. But making all tests pass
was a big chore. As more code moves to getpath(), there will likely be
opportunities to improve things a bit.
2015-09-06 11:28:48 -07:00
Yuya Nishihara
b81b754fe6 templater: catch regexp error at sub() function
This patch splits re.sub() into re.compile() and sub() so that it can
distinguish which argument causes re.error.
2015-09-07 21:58:17 +09:00
Durham Goode
bdd9abd3d3 blackbox: add pid to output
This adds the process id to the line header for the blackbox output. This is
useful for distinguishing processes when using the blackbox on a server and many
processes are writing to the blackbox at once.
2015-09-07 11:31:44 -07:00
timeless@mozdev.org
5dce21bc0b help/config: make defaults consistent 2015-09-02 13:39:46 -04:00
Anton Shestakov
039254207e tests: fix css-related test-hgweb.t breakage from c9bd2969e789 2015-09-04 21:12:07 +08:00
timeless@mozdev.org
8723ae9196 test-strip: fix spelling of initialization (en-US) 2015-08-28 13:57:20 -04:00
timeless@mozdev.org
d58a9315b3 minirst: handle edge in hunting for parents
test for "hg help -c config" in help config

``section``
-----------
section text

``def1``
    definition of def1
    $ hg help scope.def1
    should list this paragraph, but not section text below...

section text

``def2``
    definition of def2
    $ hg help scope.def2
    should list this paragraph, but not section text below...

section text
$ hg help scope.section should show everything from the first
section text to this last line.

``section2``
------------
2015-09-03 17:06:27 -04:00
timeless@mozdev.org
d8bcace010 test-merge-tools: include /usr/sbin in path for sysctl (issue4813)
/bin/sh expects to be able to reach sysctl via path (it lives in /usr/sbin)
2015-09-02 16:56:04 -04:00
liscju
436c14ee4b rebase: fix warning about ignoring tool option on rebase continue (issue4698)
Before this patch rebase --continue with specified --tool option outputs
warnings "tool option will be ignored". It is false statement because
in case of any merge conflicts it uses specified tool to resolve it.

This patch makes this warning appears only when user specified --tool
when running rebase --abort , in this case tool doesn't have any
sense
2015-09-01 21:37:51 +02:00
timeless@mozdev.org
7af87795c9 commands: support hg help scripting.HGPLAIN
keywords are lowercased within help/minirst...
2015-09-02 23:50:45 -04:00
timeless@mozdev.org
20963e1f94 run-tests: use $HGTEST_RUN_TESTS_PURE
test-run-tests and test-hghave call run-tests;
if you don't have a working build environment, and you are trying
to use --pure, then if they don't use --pure or --with-hg,
they'll break.
2015-09-02 15:19:05 -04:00
timeless@mozdev.org
f9b3b64087 minirst: don't treat top level item as children of last item (issue4803)
test for "hg help -c config" in help config
2015-09-02 15:12:08 -04:00
Durham Goode
a3e74a7ca5 convert: remove restriction on multiple --rev in hg source
Multiple --rev args on convert is a new feature, and was initially disabled for
all sources. It has since been enabled on git sources, and this patch enables it
on mercurial sources.
2015-09-03 10:29:42 -07:00
Augie Fackler
ad2436c3e6 debian: switch to using debhelper and dh_python2 to build debs
This is a much larger commit than I'd like, but I honestly don't see a
good way to break it up and leave things working. Summary:

We now use debian/rules with debhelper to build our debs. This is much
more standard, and means we use dh_python2 to do things like handle
leaving .pyc files out of the built debs.

The resulting package is split into mercurial and mercurial-common,
with the former being the hg stub and all the native .sos, and the
latter being basically everything else.

builddeb and dockerdeb are updated to use the new system. The old way
(using dpkg by hand) breaks with the above changes because
debian/control no longer contains a version string (that's now guessed
from the phony changelog.)

Tests are updated to assert that the right files end up in the right
debs.
2015-08-26 10:59:09 -04:00
Augie Fackler
6e75d70184 test-debian-packages: new test for testing construction of debian packages 2015-08-25 00:08:29 -04:00
Augie Fackler
bde2ffd969 test-docker-packaging: test packages built using docker
For now this only tests debian packages, but it could easily be
extended to also test rpms.
2015-08-31 22:44:57 -04:00
Augie Fackler
48d9b40177 hghave: correct test for debhelper
debhelper exits with a nonzero status when you pass --help, at least
on jessie.
2015-08-31 22:43:33 -04:00
Augie Fackler
b9db4815ce bundle2: don't try to recover from a GeneratorExit (issue4785)
GeneratorExit means the other end of the conversation has already
stopped listening, so don't try and yield out error
information. Instead, just let the GeneratorExit propagate normally.

This should resolve esoteric issues observed with servers that have
aggressive timeouts waiting for data to send to clients logging
internal Python errors[0]. This has been observed with both gunicorn's
gevent worker model and with scm-manager's built-in webserver (which
itself is something sitting inside jetty.)


0: Exception RuntimeError: 'generator ignored GeneratorExit' in <generator object getchunks at 0x7fd2f6c586e0> ignored
2015-09-01 15:47:33 -04:00
Yuya Nishihara
69537fb219 dispatch: error out on invalid -R path even if optionalrepo (issue4805) (BC)
Before this patch, repo could be set to None for wrong -R. It's okay for
commands that can reject repo=None, but the command server have a problem
because:

 - it accepts repo=None for "unbound" mode
 - and it reenters dispatch() where repo object is created for cwd by default

Test outputs are changed because the error is detected earlier. I think new
message is better than ".hg not found".
2015-08-31 23:29:15 +09:00
Yuya Nishihara
4ae9b32bb2 test-ssh: remove superfluous triple slashes from absolute path test
Because pwd should start with "/", "/`pwd`" is enough to make absolute path.
2015-09-01 16:38:52 +09:00
Augie Fackler
3ef1c74897 hghave: use subprocess instead of os.popen
os.popen was deprecated in Python 2.6 in favor of subprocess, so let's
move into the future.
2015-08-31 22:44:20 -04:00
Anton Shestakov
7e5ab1949a hgweb: use webutil.branchentries for branches on summary page
This allows showing correct status for each branch, which was missing on
/summary. Usually that means that closed branches get the same css class
(resulting in e.g. different color/shade) as they do on /branches page.

The sorting of the branches on summary page also changes and is now the same as
on /branches page: closed branches are now at the end of the list.
2015-09-01 23:29:30 +08:00
Yuya Nishihara
606d99d1eb templater: add optional timezone argument to localdate()
The keyword extension uses "utcdate" for a different function, so we can't
add new "utcdate" filter or function. Instead, this patch extends "localdate"
to a general timezone converter.
2015-08-18 22:15:46 +09:00
Yuya Nishihara
246636f6db templater: port localdate filter to a function
It will be extended to accept a timezone argument.
2015-09-01 19:15:16 +09:00
Durham Goode
be92ed2487 revlog: add an aggressivemergedelta option
This adds an option for delta'ing against both p1 and p2 when applying merge
revisions and picking whichever is smallest.

Some before and after stats on manifest.d size:

internal large repo:
before: 1.2 GB
after: 930 MB

mozilla-central:
before: 261 MB
after: 92 MB
2015-08-30 14:03:32 -07:00
Anton Shestakov
6076d5ac3f monoblue: add archive links on summary page 2015-08-19 21:43:13 +08:00
timeless@mozdev.org
3a5cdbfaac help: distinguish sections when multiple match (issue4802) 2015-08-30 19:03:38 -04:00
Augie Fackler
a638241af1 hghave: add a check for docker support
This currently refuses to operate if on a non-Linux host. I suspect
that Docker running on FreeBSD 11 or on an Illumos derivative would
work fine, but I don't have ready access to such a system.

On OS X using boot2docker (I used a hacky xhyve-based one for
testing), it won't work because $TESTTEMP doesn't end up inside the
set of directories that get forwarded to the boot2docker VM, so you
can't actually drop debs in the $TESTTEMP at all. It would be possible
(probably even trivial) to hack around this by using a randomly-named
temporary directory inside the working directory, but that seems
unlikely to be useful enough to justify the ugliness.
2015-08-25 00:06:41 -04:00
Augie Fackler
424fcf4978 hghave: add a check for debian packaging tools 2015-08-25 00:03:15 -04:00
Augie Fackler
cd6222a983 run-tests: add support for marking tests as very slow
I want to add tests for our packaging rules, but those necessarily run
a whole build, or possibly two if both native packaging and docker are
available. This lets us flag such tests with a `#require slow` so that
they don't unnecessarily slow down normal test runs.
2015-08-24 22:23:45 -04:00
Pierre-Yves David
4cfd7f9399 update: wlock the repo for the whole 'hg update' command
The update command is touching the repository and should lock it for
the length of its operations. Equally importantly, it should lock the
repository when it is writing bookmarks. It wasn't doing so until now,
leaving doors open for all kinds of drunk beaver parties.

This results in some minor tests changes, and the fixing of a couple
of bugs from race conditions.

Code does not receive any changes beside extra indentation.
2015-08-11 16:26:12 -07:00
FUJIWARA Katsunori
e919bf727c hg: avoid auto sharing when the clone destination is remote
Before this patch, when auto sharing is enabled, 'hg.clone()' tries to
create local clone regardless of locality of the clone destination on
the host, and causes failure.

To avoid auto sharing when the clone destination is remote, this patch
adds examination of 'islocal(dest)' before auto sharing in
'hg.clone()'.

'islocal(dest)' is examined after 'sharepool', because:

  - the former is more expensive than the latter
  - without enabling share extension, the later is always negative
2015-08-13 15:07:07 +09:00
Matt Harbison
dd27c92fee largefiles: ensure lfutil.getstandinmatcher() only matches standins
Previously, simply having the largefiles extension loaded without any largefiles
added would crash when amending with -I.  The problem was with no files in the
matcher, the pattern list of files joined with 'standindir' was empty, and
scmutil.match() would match everything.  In lfutil.composestandinmatcher(), the
match function is used to test if the file is a standin, and after getting a
false positive, proceeds to call lfutil.splitstandin().  This returns None
because it isn't a standin, which blows up when passed to rmatcher.matchfn().

Manually overriding _always in getstandinmatcher() probably isn't necessary
anymore, but we leave well enough alone on stable.  This regressed in
78632d61a993.
2015-08-12 12:26:39 -04:00
Pierre-Yves David
618daeb9ac strip: use the 'finally: tr.release' pattern during stripping
The previous code, was calling 'abort' in all exception cases. This was wrong
when an exception was raised by post-close callback on the transaction. Calling
'abort' on an already closed transaction resulted in a error, shadowing the
original error.

We now use the same pattern as everywhere else. 'tr.release()' will abort the
transaction if we escape the scope without closing it. We add a test to make
sure we do not regress.
2015-08-08 14:50:03 -07:00
Matt Harbison
3c940eb21b match: fix a caseonly rename + explicit path commit on icasefs (issue4768)
The problem was that the former name and the new name are both normalized to the
case in dirstate, so matcher._files would be ['ABC.txt', 'ABC.txt'].
localrepo.commit() calls localrepo.status(), passing along the matcher.  Inside
dirstate.status(), _walkexplicit() simply grabs matcher.files() and processes
those items.  Since the old name isn't present, it is silently dropped.  There's
a fundamental tension here, because the status command should also accept files
that don't match the filesystem, so we can't drop the normalization in status.
The problem originated in d70aa474bd84.

Unfortunately with this change, the case of the old file must still be specified
exactly, or the old file is again silently excluded.  I went back to
d70aa474bd84^, and that had the same behavior, so we are no worse off.  I'm open
to ideas from a matcher or dirstate expert on how to fix that half.
2015-08-06 21:00:16 -04:00
Durham Goode
8f62a68933 convert: fix git copy file content conversions
There was a bug in the git convert code where if you copied a file and modified
the copy source in the same commit, and if the copy dest was alphabetically
earlier than the copy source, the converted version would use the copy dest
contents for both the source and the target.

The root of the bug is that the git diff-tree output is formatted like so:

:<mode> <mode> <oldhash>    <newhash>    <state> <src>   <dest>
:100644 100644 c1ab79a15... 3dfc779ab... C069    oldname newname
:100644 100644 c1ab79a15... 03e2188a6... M       oldname

The old code would always take the 'oldname' field as the name of the file being
processed, then it would try to do an extra convert for the newname. This works
for renames because it does a delete for the oldname and a create for the
newname.

For copies though, it ends up associating the copied content (3dfc779ab above)
with the oldname. It only happened when the dest was alphabetically before
because that meant the copy got processed before the modification.

The fix is the treat copy lines as affecting only the newname, and not marking
the oldname as processed.
2015-08-06 17:21:46 -07:00
Yuya Nishihara
6bf30cb038 revset: prevent crash caused by empty group expression while optimizing "or"
An empty group expression "()" generates None in AST, so it should be tested
before destructuring a tuple.

"A | ()" is still evaluated to an error because I'm not sure whether "()"
represents an empty set or an empty expression (= a unit value). They are
identical in "or" operation, but they should be evaluated differently in
"and" operation.

  expression  empty set  unit value
  ----------  ---------  ----------
  ()          {}         A
  A & ()      {}         A
  A | ()      A          A
2015-08-09 16:09:41 +09:00
Yuya Nishihara
1ebcb08eb6 revset: prevent crash caused by empty group expression while optimizing "and"
An empty group expression "()" generates None in AST, so the optimizer have
to test it before destructuring a tuple. The error message, "missing argument",
is somewhat obscure, but it should be better than crash.
2015-08-09 16:06:36 +09:00
Anton Shestakov
6a4a921104 filesets: ignore unit case in size() predicate for single value
When specifying one plain value in size(), e.g. size(1k), fileset tries to
guess the upper bound automatically (see the comment in _sizetomax()). It
didn't ignore the specified unit's case, and so size("1 GB"), for example,
produced this error:

hg: parse error: couldn't parse size: 1 GB

Let's do the same thing that util.sizetoint() does: .lower().

The two test lines without output just check that there are no parse errors.
2015-08-08 14:42:27 +08:00
Pierre-Yves David
6b2961e47a histedit: backout 3e883e7ec57b
The faulty changeset use obsolescence marker to roll the repository back on
--abort. This is a problematic approach because --abort should be as close as an
actually transaction rollback as possible stripping all created data from the
repository (cf `hg rebase --abort` stripping all created changesets). Instead
3e883e7ec57b made all content created during the aborted histedit still
available in the repository adding obsolescence marker to make them hidden. This
will cause trouble to evolution user as a re-run of the same histedit (with
success) will likely result in the very same node to be "recreated" while
obsolescence marker would be in place for them. And canceling an obsoletion is
still a fairly complicated process.

This also rollback using obsmarkers instead of strip to clean up temporary node
on successful histedit run because the two change were not split in separated
changeset. Rolling that part back does not have significant consequence a will
have to be resubmitted independently
2015-07-31 15:11:07 -07:00
Eugene Baranov
322848b810 convert: when converting from Perforce use original local encoding by default
On Windows Perforce command line client uses default system locale to encode
output. Using 'latin_1' causes locale-specific characters to be replaced with
question marks. With this patch we will use default locale by default whilst
allowing to specify it explicity with 'convert.p4.encoding' config option.

This is a potentially breaking change for any scripts relying on output treated
as in 'latin_1' encoding.

Also because hgext.convert.convcmd overwrites detected default system locale
with UTF-8 we had to introduce an import cycle in hgext.convert.p4 to retrieve
originally detected encoding from hgext.convert.convcmd.
2015-07-22 16:57:11 +01:00
Gregory Szorc
db719a7a87 help: scripting help topic
There are a lot of non-human consumers of Mercurial. And the challenges
and considerations for machines consuming Mercurial is significantly
different from what humans face.

I think there are enough special considerations around how machines
consume Mercurial that a dedicated help topic is warranted. I concede
the audience for this topic is probably small compared to the general
audience. However, lots of normal Mercurial users do things like create
one-off shell scripts for common workflows that I think this is useful
enough to be in the install (as opposed to, say, a wiki page - which
most users will likely never find).

This text is by no means perfect. But you have to start somewhere. I
think I did cover the important parts, though.
2015-07-18 17:10:28 -07:00
Matt Harbison
5dece5b905 convert: document convert.hg.startrev 2015-07-29 21:31:56 -04:00
FUJIWARA Katsunori
2fb0db56cb transplant: restore dirstate correctly at unexpected failure
Before this patch, transplant can't restore dirstate as expected at
failure other than one while patching. This causes:

  - unexpected file status

  - dirstate refers already rollback-ed parent
    (only at failure of transplanting the 2nd or later revision)

To restore dirstate correctly also at unexpected failure, this patch
encloses scope of store lock and transaction by 'dirstateguard'.

This is temporary fixing for stable branch. See
DirstateTransactionPlan wiki page for detail about the future plan to
treat dirstate consistently around scope boundary of transaction.

    https://mercurial.selenic.com/wiki/DirstateTransactionPlan

This patch also adds 'if lock' examination for safety
'lock.release()', because creating 'dirstateguard' object may fail
unexpectedly (e.g. IOError for saving dirstate).

BTW, in the test script, putting section header '[extensions]' into
'.hg/hgrc' is needed to fix incomplete disabling 'abort' extension at
d0d06f4ca862.
2015-07-30 06:22:09 +09:00
FUJIWARA Katsunori
4865b28d1a localrepo: make journal.dirstate contain in-memory changes before transaction
Before this patch, in-memory dirstate changes aren't written out at
opening transaction, even though 'journal.dirstate' is created
directly from '.hg/dirstate'.

Therefore, subsequent 'hg rollback' uses incomplete 'undo.dirstate' to
restore dirstate, if dirstate is changed and isn't written out before
opening transaction.

In cases below, the condition "dirstate is changed and isn't written
out before opening transaction" isn't satisfied and this problem
doesn't appear:

  - "wlock scope" and "transaction scope" are almost equivalent

    e.g. 'commit --amend', 'import' and so on

  - dirstate changes are written out before opening transaction

    e.g. 'rebase' (via 'dirstateguard') and 'commit -A' (by separated
    wlock scopes)

On the other hand, 'backout' may satisfy the condition above.

To make 'journal.dirstate' contain in-memory changes before opening
transaction, this patch explicitly invokes 'dirstate.write()' in
'localrepository.transaction()'.

'dirstate.write()' is placed before not "writing journal files out"
but "invoking pretxnopen hooks" for visibility of dirstate changes to
external hook processes.

BTW, in the test script, 'touch -t 200001010000' and 'hg status' are
invoked to make file 'c' surely clean in dirstate, because "clean but
unsure" files indirectly cause 'dirstate.write()' at 'repo.status()'
in 'repo.commit()' (see e1d123a2ee1f for detail) and prevents from
certainly reproducing the issue.
2015-07-30 06:16:12 +09:00
Matt Harbison
e8c6c3b443 dirstate: ensure mv source is marked deleted when walking icasefs (issue4760)
Previously, importing a case-only rename patch on a case insensitive filesystem
caused the original file to be marked as '!' in status.  The source was being
forgotten properly in patch.workingbackend.close(), but the call it makes to
scmutil.marktouched() then put the file back into the 'n' state (but it was
still missing from the filesystem).

The cause of this was scmutil._interestingfiles() would walk dirstate,
and since dirstate was able to lstat() the old file via the new name,
was treating this as a forgotten file, not a removed file.
scmutil.marktouched() re-adds forgotten files, so dirstate got out of
sync with the filesystem.

This could be handled with less code in the "kind == regkind or kind
== lnkkind" branch of dirstate._walkexplicit(), but this avoids
filesystem accesses unless case collisions occur. _discoverpath() is
used instead of normalize(), since the dirstate case is given first
precedence, and the old file is still in it. What matters is the
actual case in the filesystem.
2015-07-27 21:27:24 -04:00
Wagner Bruna
f6ce8ccc47 repair: fix typo in warning message 2015-07-26 09:28:52 -03:00
Durham Goode
677efb706e ignore: fix include: rules depending on current directory (issue4759)
When reading pattern files, we just call open(path), which is relative to the
current directory.  Let's fix this by resolving the paths before attempting to
read the file.
2015-07-24 16:44:52 -07:00
Durham Goode
c9da9870f4 test: move ignore test run into a subdirectory
Previously the hgignore test just called hg init in the test directory. A future
patch needs to test hgignore stuff from outside of the repo, so let's move the
entire test repo into a subdirectory.
2015-07-24 16:43:21 -07:00
Anton Shestakov
403857c028 highlight: produce correct markup when there's a blank line just before EOF
Due to how the colorized output from pygments was stripped of <pre> elements,
when there was an empty line at the end of a file, highlight extension produced
an incorrect markup (no closing tags from the fileline/annotateline template).
It wasn't usually noticeable, because browsers were smart enough to see where
the missing tags should've been, but in monoblue style it resulted in the last
line having twice the normal height.

Instead of awkwardly trying to strip outer <pre></pre> tags, let's make the
formatter with nowrap=True, which should do what we need in pygments since at
least 0.5 (2006-10-30).

Example from monoblue style:

Before:

    <div class="source">

<div style="font-family:monospace" class="parity0">
<pre><a class="linenr" href="#l1" id="l1">     1</a> </pre>
</div>
<div style="font-family:monospace" class="parity1">
<pre><a class="linenr" href="#l2" id="l2">     2</a>
    </div>

Now:

    <div class="source">

<div style="font-family:monospace" class="parity0">
<pre><a class="linenr" href="#l1" id="l1">     1</a> </pre>
</div>
<div style="font-family:monospace" class="parity1">
<pre><a class="linenr" href="#l2" id="l2">     2</a> </pre>
</div>
    </div>

(Notice the missing </pre></div> now in place)
2015-07-22 10:19:17 +08:00
Matt Harbison
1fb45c7e46 test-check-config: convert directory separators to '/' for MSYS
The output of the files command uses native separator.  MSYS then seems to drop
the '\' on Windows when invoking python:

 --- c:/Users/Matt/Projects/hg/tests/test-check-config-hg.t
 +++ c:/Users/Matt/Projects/hg/tests/test-check-config-hg.t.err
 @@ -6,22 +6,10 @@

    $ hg files "set:(**.py or **.txt) - tests/**" |
    >   xargs python contrib/check-config.py  Traceback (most recent call last):
      File "contrib/check-config.py", line 93, in <module>
        sys.exit(main(sys.argv[1:]))
      File "contrib/check-config.py", line 24, in main
        for l in open(f):
    IOError: [Errno 2] No such file or directory: 'contriball-revsets.txt'
    [123]
2015-07-20 23:33:57 -04:00
Matt Harbison
3e67d17d81 test-subrepo: fix globs for Windows
It looks like these changes originated with 23b60798c736.  I'm not sure that it
was intentional, but is seems harmless enough for an error message.
2015-07-20 22:48:42 -04:00
Matt Harbison
9af3be2f3b test-clone: fix globs for Windows 2015-07-20 22:44:53 -04:00
Danek Duvall
256c943981 tests: diff -r on Solaris emits "Common subdirectories:"
When using the -r option to Solaris diff, any directores that compare
identically are mentioned in the output.  We don't really care about these
directories for the purposes of this test, so ignore them.
2015-07-20 15:42:39 -07:00
Danek Duvall
ccade6afcc tests: work around differing hunk headers between GNU and Solaris diff
The hunk headers specifying what lines the hunk apply to differ.  They're
irrelevant to the test, so just eliminate them from the output.
2015-07-20 15:39:15 -07:00
Danek Duvall
6c0991c070 tests: use egrep with regular expression branches for compatibility
GNU grep allows you to use "a\|b" in a regular expression to match either
"a" or "b", but at least Solaris grep does not; only egrep allows for that.
And egrep considers "a+" to be "a{1,}" instead of an "a" and a literal plus
sign, so escape that as well.
2015-07-20 15:33:20 -07:00
Yuya Nishihara
d7d0977d82 tests: disable test of buffer overflow in parsers.c if --pure
It fails with AttributeError and there's no benefit to make it runnable
with pure Python code.
2015-07-19 15:27:28 +09:00
Yuya Nishihara
4377cc9e4b templatefilters: remove redundant 'date' and 'strip' filters
These filters are defined as 'date()' and 'strip()' functions. Help messages
are moved to the corresponding functions.
2015-07-04 16:07:42 +09:00
Yuya Nishihara
cb4039a392 templater: introduce unified filter syntax for unary functions
"filter(expr)" is allowed already. This patch adds the opposite, "expr|func".
2015-07-04 16:03:36 +09:00
liscju
6d8f9192e4 clone: fix updaterev to update to latest branch changeset (issue4528)
Before this patch if clone --updaterev points to branch which head
on src repo wasnt in dest repo, clone updated dest repo to
default branch. After applying this patch, if changeset from
src repo pointing at given branch is not in dest repo, it searches
for changeset pointing for given branch locally in dest repo.

Lookup in destination repo:
  559: uprev = destrepo.lookup(update)
is wrapped by try/except block to preserve current behaviour when
given revset to -u is not found - it will not fail,but silently update
dest repo to head of default branch.
2015-08-30 11:47:43 +02:00
liscju
e42f8565a1 revsets: makes follow() supports file patterns (issue4757) (BC)
Before this patch, follow only supports full, exact filenames.
This patch makes follow argument to be treated like file
pattern same way like log treats their arguments.

It preserves current behaviour of follow() matching paths
relative to the repository root by default.
2015-08-20 17:19:32 +02:00
timeless@mozdev.org
e88cb37448 histedit: improve discoverability of edit commit message 2015-08-28 15:50:36 -04:00
timeless@mozdev.org
52eae47139 spelling: behaviour -> behavior 2015-08-28 10:53:55 -04:00
Yuya Nishihara
d0b6532f54 reachableroots: construct and sort baseset in revset module
This can remove the dependency from changelog to revset, which seems a bit awkward
for me.
2015-08-28 11:14:24 +09:00
Augie Fackler
7a593002d6 run-tests: ignore failed removal of nonexistent installerrs
When running tests with -j100 or so on a large machine, I see this
os.remove call failing semi-regularly. Since it's not really a problem
when the file is already gone, just suppress the error in that case.
2015-08-25 00:40:42 -04:00
Durham Goode
aa9d278287 convert: fix syncing deletes from p2 merge commit
Recently we fixed converting merges to correctly sync changes from p2. We missed
the case of deletes though (so p2 deleted a file that p1 had not yet deleted,
and the file does not belong to the source).

The fix is to detect when p2 doesn't have the file, so we just sync it as a
delete to p1 in the merge.

Updated the test, and verified it failed before the fix.
2015-08-25 15:54:33 -07:00
Durham Goode
d57c6ca233 convert: add convert.git.skipsubmodules option
This adds an option to not pull in gitsubmodules during a convert. This is
useful when converting large git repositories where gitsubmodules were allowed
historically, but are no longer wanted.
2015-08-24 22:16:01 -07:00
Gregory Szorc
6e680ddd62 hgweb: make refresh interval configurable
hgwebdir refreshes the set of known repositories periodically. This
is necessary because refreshing on every request could add significant
request latency.

More than once I've found myself wanting to tweak this interval at
Mozilla. I've also wanted the ability to always refresh (often when
writing tests for our replication setup).

This patch makes the refresh interval configurable. Negative values
indicate to always refresh. The default is left unchanged.
2015-08-22 22:59:51 -07:00
Erik Huelsmann
5e269b46c8 filemerge: add 'union' merge to internal merge tool
'union merge' is a merge strategy which adds both left and right hand side
of a conflict region. Git implements this merge strategy which is very
practical to have for merging e.g. the Changelog file.
2015-08-16 10:19:00 +02:00
Gregory Szorc
0b8074fef5 hghave: remove quiet option
The --quiet flag appears to be unused. Kill it.
2015-08-22 10:37:38 -07:00
Gregory Szorc
c7aeb97f0b hghave: move feature checking into hghave.py
Upcoming patches will kill hghave (the script - not hghave.py) and
will move to a model where requirements checking is performed as
a function call.

Start diminishing the utility of hghave by moving some code to
hghave.py.
2015-08-22 10:28:34 -07:00
Gregory Szorc
97abeb0809 tests: move '#require bzr' into .t files
The bzr tests are the only .t tests calling hghave (aside from the tests
testing hghave itself). This pattern is a one-off and prevents
desired refactors to how requirements checking is integrated into tests.
Use the convention used everywhere else.
2015-08-22 10:22:12 -07:00
Matt Mackall
9630b6a23f tests: add a check-config pass 2015-06-26 18:45:29 -05:00
Yuya Nishihara
f7a6661b37 revset: parse nullary ":" operator as "0:tip"
This is necessary for compatibility with the old-style parser that will be
removed by future patches.
2015-07-05 12:15:54 +09:00
Pierre-Yves David
25876521c9 reachableroots: use baseset lazy sorting
smartset sorting is lazy (so faster in some case) and better (informs that the
set is sorted allowing some optimisation). So we rely on it directly.

Some test output are updated because we now have more information (ordering).
2015-08-20 17:23:21 -07:00
Gregory Szorc
83c1331bbb commands.push: use paths API
ui.path instances now collect most of the data used by commands.push().
Move away from ui.expandpath() and call ui.paths.getpath() to get a
path instance.

Some "pushing to" output was dropped as one test demonstrates. I believe
the dropped message was redundant with the error message and the change
to be acceptable.
2015-08-07 22:39:47 -07:00
Yuya Nishihara
7f0aba37f0 reachableroots: use internal "revstates" array to test if rev is a root
The main goal of this patch series is to reduce the use of PyXxx() function
that is likely to require ugly error handling and inc/decref. Plus, this is
faster than using PySet_Contains().

  revset #0: 0::tip
  0) 0.004168
  1) 0.003678  88%

This patch ignores out-of-range roots as they are in the pure implementation.
Because reachable sets are calculated from heads, and out-of-range heads raise
IndexError, we can just take out-of-range roots as unreachable. Otherwise,
the test of "hg log -Gr '. + wdir()'" would fail.

"heads" argument is changed to a list. Should we have to rename the C function
as its signature is changed?
2015-08-14 15:43:29 +09:00
Matt Mackall
9bea9bc9bb merge with stable 2015-08-18 18:38:56 -05:00
Durham Goode
e41971b2a5 convert: fix convert dropping p2 contents during filemap merge
When converting a merge commit using a filemap convert (i.e. when moving
contents from the root of the repo into subdir1/), convert would silently drop
the entire contents of the target repo's p2. This was because when it built the
target commit, it did so by taking the target p1 and adding only the files that
changed in the source repo's merge commit.

This breaks in the case where the target repo has files that are unrelated to
the source repo (like in the case where you use convert to import a repo as a
subdirectory of another).

The fix is to use Mercurial's merge logic to detect which files in p2 we should
carry over to the merge. It follows three rules:

1) if the file belongs to the source, don't try to merge it. Rely on the list of
files provided to putcommit to be correct.

2) if the file requires merging or user input (change vs deleted), throw an
exception. We don't have enough info to do this.

3) if p2 has the newest, non-merge-requiring version of the file, take it

I've also added a test to cover this issue.
2015-08-14 15:22:47 -07:00
Matt Mackall
155b19726c merge with stable 2015-08-13 19:37:47 -05:00
Durham Goode
099689de6b dirstate: add --minimal flag to debugrebuilddirstate
On repositories with hundreds of thousands of files, hg
debugrebuilddirstate causes every dirstate entry to be marked lookup,
and the next hg status can take many minutes.

This adds a --minimal flag that allows us to only rebuild the parts of the
dirstate that are inconsistent. This follows two rules:

1) If a file is in the dirstate but not in the parent manifest, and it is not
marked 'add', it is busted and we should drop it.

2) If a file is not in the dirstate at all, but it is in the parent
manifest, it should be added to the dirstate and we need to mark it as
lookup.

This allows us to fix repositories where the dirstate doesn't match
the manifest much more quickly.

Tested by artificially adding bad dirstate entries (via code) for both cases
above.
2015-08-12 19:44:21 -07:00
FUJIWARA Katsunori
6e07d94050 tests: make filterpyflakes.py read target files relatively to cwd
Before this patch, 'filterpyflakes.py' reads target files relatively
to own location.

But this prevents third party tools from using it in own source tree,
because their files are placed separately from 'filterpyflakes.py'.

In fact, 'test-check-pyflakes.t', which is the only user of
'filterpyflakes.py', changes current working directory (cwd) to the
root of "test target" source tree before using it. Therefore,
composing the root of source tree in 'filterpyflakes.py' is redundant.

This patch makes 'filterpyflakes.py' read target files relatively to
cwd by invoking 'open()' without any path composition. This also
removes importing 'os' module, because there is no user of it after
this patch.

This is a one of preparation of issue4677.
2015-08-13 22:10:52 +09:00
Anton Shestakov
23dddb305b monoblue: remove unused elements and related css
Since f9c487618909 and 9d5bd0e29076, when monoblue was introduced, the code
this patch removes was untouched. Presumably, there supposed to be nice
graphics in the screen corners, but there never were due to:

- the css being commented out
- ids of the elements and of the css selectors being different
- and the png files absent

The "corner" elements were unstyled and didn't affect the rest of the page, so
I think it's safe to remove all this.
2015-08-11 13:45:54 +08:00
Yuya Nishihara
8e8af6e090 revpair: restrict odd-range handling to top-level x:y expression (issue4774)
The odd-range hack was introduced by 9afcfbca1710 for backward compatibility,
but it was too widely applied. I've checked cmdutil.revpair() at 1.6, and
found that ".:", ":0" and ":" are also handled as pairs. So let's enable the
hack only for "x:y", "x:", "y:" and ":".

test-revset.t is updated because "tip^::tip^ or tip^" shouldn't be taken as
an odd range. This patch adds "tip^:tip^" instead.

This patch is written for the default branch because parse() of the stable
branch lacks compatibility hack for "foo+bar" tag. If we want to mitigate the
issue in stable, we can add something like "and '::' in revs[0]".
2015-08-13 16:15:43 +09:00
Yuya Nishihara
de0c78a969 revpair: update test to make a difference if odd range not handled specially
It was added at 9afcfbca1710, but there was no difference between -r2 and -r2:2
because the working directory was clean.
2015-08-13 16:27:32 +09:00
Yuya Nishihara
1566598e14 reachableroots: verify type of each item of heads argument
Though PyInt_AS_LONG() can return a value no matter if it isn't an int object,
it could exceed the boundary of the underlying struct. I think C API should be
defensive to such errors.
2015-08-13 18:59:49 +09:00
Yuya Nishihara
01d4a46e15 reachableroots: verify integer range of heads argument (issue4775)
Now it raises IndexError instead of SEGV for 'wdir()' as it was before.
2015-08-13 18:38:46 +09:00
Yuya Nishihara
d210a7a2bf reachableroots: unify bail cases to raise exception correctly
Before this patch, release_seen_and_tovisit did not return NULL, so the
exception was not raised immediately. As Py_XDECREF() and free() are safe
for NULL, we can simply bail in any case.
2015-08-13 18:29:38 +09:00
Matt Mackall
dc3c45835d merge with stable 2015-08-12 17:01:50 -05:00
Durham Goode
1bef6fef82 copy: add flag for disabling copy tracing
Copy tracing can be up to 80% of rebase time when rebasing stacks of commits in
large repos (hundreds of thousands of files).  This provides the option of
turning off the majority of copy tracing. It does not turn off _forwardcopies()
since that is used to carry copy information inside a commit across a rebase.

This will affect the situation where a user edits a file, then rebases on top of
commits that have moved that file. The move will not be detected and the user
will have to manually resolve the issue (possibly by redoing the rebase with
this flag off).

The reason to have a flag instead of trying to fix the actual copy tracing
performance is that copy tracing is fundamentally an O(number of files in the
repo) operation.  In order to know if file X in the rebase source was copied
anywhere, we have to walk the filelog for every new file that exists in the
rebase destination (i.e. a file in the destination that is not in the common
ancestor).  Without an index that lets us trace forward (i.e. from file Y in the
common ancestor forward to the rebase destination), it will never be an O(number
of changes in my branch) operation.

In mozilla-central, rebasing a 3 commit stack across 20,000 revs goes from 39s
to 11s.
2015-01-27 11:26:27 -08:00
Matt Mackall
6c04738a65 merge with stable 2015-08-10 15:30:28 -05:00
Gregory Szorc
97fa6a9809 ui: use absolute_import
And we have no more ambiguous mixed imports \o/
2015-08-08 18:25:41 -07:00
Gregory Szorc
1e68b1d684 templater: use absolute_import 2015-08-08 18:23:53 -07:00
Gregory Szorc
754028767d revset: use absolute_import 2015-08-08 18:36:58 -07:00
Gregory Szorc
bf31c39d5d fileset: use absolute_import 2015-08-08 18:34:37 -07:00
Gregory Szorc
177174bac6 dispatch: use absolute_import
A mixed, ambiguous import has been removed!
2015-08-08 14:42:48 -07:00
Gregory Szorc
788d5ef232 commands: break import cycle
This was the easiest link in the chain to break as there was only
one use of commandserver in commands.py. Other files had multiple
users.
2015-08-08 14:30:39 -07:00
Gregory Szorc
a935029795 cmdutil: break import cycle
This was the easiest place to break the chain, as there were only
2 uses of the imported module in the file.
2015-08-08 00:47:19 -07:00
Augie Fackler
6a6926de03 batching: migrate basic noop batching into peer.peer
"Real" batching only makes sense for wirepeers, but it greatly
simplifies the clients of peer instances if they can be ignorant to
actual batching capabilities of that peer. By moving the
not-really-batched batching code into peer.peer, all peer instances
now work with the batching API, thus simplifying users.

This leaves a couple of name forwards in wirepeer.py. Originally I had
planned to clean those up, but it kind of unclarifies other bits of
code that want to use batching, so I think it makes sense for the
names to stay exposed by wireproto. Specifically, almost nothing is
currently aware of peer (see largefiles.proto for an example), so
making them be aware of the peer module *and* the wireproto module
seems like some abstraction leakage. I *think* the right long-term fix
would actually be to make wireproto an implementation detail that
clients wouldn't need to know about, but I don't really know what that
would entail at the moment.

As far as I'm aware, no clients of batching in third-party extensions
will need updating, which is nice icing.
2015-08-05 14:51:34 -04:00
Durham Goode
4126c0d435 convert: fix git convert using servers branches
The conversion from git to hg was reading the remote branch list directly from
the origin server. If the origin's branch had moved forward since the last git
fetch, it would return a git hash which didn't exist locally, and therefore the
branch was not converted.

This changes it to rely on the local repo's refs/remotes list of branches
instead, so it's completely cut off from the server.
2015-07-29 13:21:03 -07:00
Yuya Nishihara
a85993b95a revset: port parsing rule of old-style ranges from scmutil.revrange()
The old-style parser will be removed soon.
2015-07-18 23:30:17 +09:00
Yuya Nishihara
137f249748 debugrevspec: pass lookup function to visualize fallback mechanism
The next patch will move the exceptional parsing of old-style ranges
to revset.tokenize(). This patch will allow us to see the result tree.

Note that the parsing result of '-a-b-c-' is incorrect at this changeset.
It will be fixed soon.
2015-07-18 23:02:18 +09:00
Pierre-Yves David
d41570d94c merge with stable 2015-08-03 14:05:42 -07:00
Siddharth Agarwal
20e8951b71 test-bookmarks.t: avoid nested repo
This is (a) pretty unnecessary and (b) breaks tests for the third-party
hgwatchman extension, which doesn't support nested repos.
2015-08-02 21:56:38 -07:00
Matt Harbison
400240f7c1 extdiff: add support for subrepos
Git and svn subrepo support is incomplete, because they don't support archiving
the working copy.
2012-07-15 12:43:10 -04:00