Commit Graph

21359 Commits

Author SHA1 Message Date
Durham Goode
0ac70cfdb2 merge: add labels parameter from merge.update to filemerge
Adds a labels function parameter to all the functions between merge.update and
filemerge.filemerge. This will allow commands like rebase to specify custom
marker labels.
2014-05-08 16:54:23 -07:00
Gregory Szorc
375be90a07 run-tests: move interactive test acceptance into TestResult
We shouldn't be performing interactive prompting during test execution.
The first step of this is to move the functionality into TestResult.
2014-04-22 13:32:05 -07:00
Gregory Szorc
70868f71e0 run-tests: raise WarnTest outside of Test.fail() 2014-04-22 13:25:17 -07:00
Gregory Szorc
382f52cba6 run-tests: move diff generation into TestResult
TestResult is the thing that captures all our test results. It's logical
for diff viewing to be handled there and not inside Test.

While writing this patch, it was discovered that Test.fail() was
printing redundant test result output. This has been removed.

Arguments controlling diffs have been removed from Test.__init__.
2014-04-22 13:16:34 -07:00
Gregory Szorc
cb478bcd7b run-tests: remove global abort flag
The global abort flag has been moved into each Test instance. A
Test.abort() accomplishing the same thing has been added.
2014-04-22 12:35:18 -07:00
Durham Goode
bcc0ea1fe2 merge: add conflict marker formatter (BC)
Adds a conflict marker formatter that can produce custom conflict marker
descriptions. It can be set via ui.mergemarkertemplate. The old behavior
can be used still by setting ui.mergemarkers=basic.

The default format is similar to:

  {node|short} {tag} {branch} {bookmarks} - {author}: "{desc|firstline}"

And renders as:

  contextblahblah
  <<<<<<< local: c7fdd7ce4652 - durham: "Fix broken stuff in my feature branch"
  line from my changes
  =======
  line from the other changes
  >>>>>>> other: a3e55d7f4d38  master - sid0: "This is a commit to master th...
  morecontextblahblah
2014-05-08 16:50:22 -07:00
Gregory Szorc
c2d6530853 run-tests: remove options from Test.__init__
All options are now passed as arguments and we no longer need options.

This enables us to instantiate Test from "plain old data" types. Since
options must be given as arguments, it also makes people think harder
about adding things that may not belong in Test. This will help ensure a
proper separation of responsibility going forward.
2014-04-22 12:20:10 -07:00
Gregory Szorc
5656f4586d run-tests: move shell to Test.__init__ 2014-04-22 12:17:23 -07:00
Gregory Szorc
285b810dae run-tests: move py3kwarnings to Test.__init__ 2014-04-22 12:15:55 -07:00
Gregory Szorc
7a6aa4b289 run-tests: move extra config options to Test.__init__ 2014-04-22 12:13:40 -07:00
Gregory Szorc
2bd392374e run-tests: refactor port number declaration
Instead of making port numbers derived from count and a global initial
port, we now pass a start port to Test.__init__ and do the calculation
at a higher level.
2014-04-22 12:10:25 -07:00
Gregory Szorc
e29eaf20cf run-tests: move timeout into Test.__init__ 2014-04-22 12:04:15 -07:00
Gregory Szorc
08548ac839 run-tests: move interactive to Test.__init__ 2014-04-22 12:01:31 -07:00
Gregory Szorc
7427586dc4 run-tests: move diff options into arguments of Test.__init__ 2014-04-22 11:58:32 -07:00
Gregory Szorc
d83a06e76b run-tests: move debug into an argument to Test.__init__ 2014-04-22 11:44:34 -07:00
Gregory Szorc
48b8b52024 run-tests: factor options.keep_tmpdir into an argument to Test.__init__ 2014-04-22 11:41:10 -07:00
Gregory Szorc
9edaec1d62 run-tests: remove redundant test name filter
TestSuite.run() doesn't need to filter tests by name because that
already happens elsewhere. Garbage in garbage out applies.
2014-04-22 12:29:33 -07:00
Gregory Szorc
d516d7b5e7 run-tests: move test filtering into TestSuite.run()
Upcoming patches will move the execution of tests to separate processes.
To facilitate this, it makes sense to move logic out of Test.
Furthermore, test filtering is logically the domain of the test runner,
not the test itself.

This patch interrupts our mini series of factoring options into named
arguments because filtering consults many options and it is easier to
move this logic out of Test sooner so we don't have to introduce
arguments at all.
2014-04-22 11:38:14 -07:00
Gregory Szorc
18e8487bdf run-tests: no longer pass a TestRunner into Test.__init__
We no longer access any attributes on TestRunner besides options, so we
stop passing a TestRunner to Test.__init__ and now pass the options
data structure instead.

Subsequent patches will move accessed options attributes into named
arguments.
2014-04-22 10:13:41 -07:00
Gregory Szorc
706551657a run-tests: pass abort into Test.__init__ 2014-04-22 10:12:19 -07:00
Gregory Szorc
71ca8805db run-tests: pass temp dir into Test.__init__
This patch starts a mini series of moving arguments to Test.__init__
from semi-complex data structures (such as the command options) to named
arguments. This will allow Test instances to be more easily instantiated
from other contexts. This improves the ability to run Mercurial tests in
new and different environments.
2014-04-22 10:05:32 -07:00
Stephen Lee
767b0ab60c update: show message when a bookmark is activated by update
When updating to a bookmark, mention that the bookmark is now
active.  This is a reminder that update does not move the
current bookmark if an explicit target is given - instead
it activates that target.
2013-03-07 14:17:56 +11:00
Gregory Szorc
b1c9f22ffa run-tests: pass a full test path into Test.__init__
Previously, a Test's path came from the base directory of all tests and
a filename leaf. There is not a strong reason why an absolute test path
can not be specified.

This change isn't strictly necessary. But it does enable scenarios such
as more easily running tests from multiple, non-sibling directories.
2014-04-22 10:01:22 -07:00
Gregory Szorc
50b1663f63 run-tests: factor refpath into Test classes
refpath is a side-effect of the test type. We therefore move it to the
Test class implementations.
2014-04-21 16:43:36 -07:00
Gregory Szorc
42d448ded4 run-tests: don't trap exceptions in Test.runTest()
Exceptions are all handled in Test.run(). This code was redundant since
the unittest test wrapper class was merged into Test.
2014-04-20 18:23:48 -07:00
Gregory Szorc
803865798c run-tests: factor options out of run()
We were only utilizing 2 parts of options. These have been converted to
named arguments.
2014-04-20 18:20:24 -07:00
Mads Kiilerich
3af50396f2 convert: mercurial source: convert global tags only - not local tags
Mercurial tags can be local (tag -l, stored in .hg/localtags) or global (normal
tags, tracked in .hgtags) ... or extensions can add other kind of tags.

Convert would take all tags (except "tip"), not just the ones from .hgtags, and
put them into .hgtags.

Instead, convert only the global tags that come from .hgtags.
2014-05-16 02:30:27 +02:00
Gregory Szorc
8e80b0bd22 run-tests: refactor temporary directories in Test
We no longer need cleanup() because setUp() and tearDown() cover it. We
move tempdir creation into setUp() and always delete in tearDown()
2014-04-20 18:15:38 -07:00
Gregory Szorc
0024c28a10 run-tests: move _executetests into TestSuite 2014-04-20 17:42:31 -07:00
Gregory Szorc
fd2322f58b run-tests: capture execution times in TestResult
TestResult has facilities for recording when tests start and stop. It
makes sense to move execution time recording into TestResult.

In addition, output generation is being moved into TestResult, a class
that has a concept of an output buffer (and a lock).
2014-04-20 17:39:26 -07:00
Gregory Szorc
b583c9eacb run-tests: move outputtimes() into unittest runner class
The unittest runner now does all the printing. Move outputtimes() there.
2014-04-20 17:28:24 -07:00
Gregory Szorc
d9c2ef0a49 run-tests: refactor how times are recorded
We now record times in Test.run(), which is a more appropriate place for
it.
2014-04-20 17:21:24 -07:00
Gregory Szorc
3c3efa484d run-tests: eliminate Test._result
The result of test execution is now reported on a TestResult. We no
longer need to store a tuple of the result.
2014-04-20 17:13:10 -07:00
Gregory Szorc
0f26e878dd run-tests: replace Test.ignore() with raise IgnoreTest 2014-04-20 17:10:49 -07:00
Gregory Szorc
352b2437a3 run-tests: replace Test.skip() with raise SkipTest
All the result functions now raise an Exception. We no longer need these
functions and we can inline the raise.
2014-04-20 17:09:52 -07:00
Gregory Szorc
2d619ddf2b run-tests: remove some legacy code around result handling
unittest handles all results now. We no longer need to manually keep
track of results.
2014-04-20 17:06:57 -07:00
Gregory Szorc
e9f9523063 run-tests: merge MercurialTest into Test
Now that we execute all tests via unittest, the MercurialTest wrapper is
not necessary. This patches moves the logic from MercurialTest into Test
and makes Test a child of unittest.TestCase.
2014-04-20 17:04:42 -07:00
Steven Brown
b97c015cd5 check-code: check for consistent usage of the websub filter in hgweb templates
The check-code tool now expects the "desc" keyword to be followed by the
"websub" filter, with the following exceptions:
a) It has no filters at all, e.g. a changeset description in the raw style
   templates or the repository description in the summary page.
b) It is followed by the "firstline" filter, e.g. the first line of the
   changeset description is displayed as a summary or title.
2014-05-17 17:11:06 +08:00
Steven Brown
1226430636 hgweb: apply websub filter to the changeset description in rss and atom feeds
For example, this is useful for linking from the feed reader to a bug tracker.

This follows the existing pattern used within the hgweb templates. With the
exception of the raw style, all usages of the changeset "desc" keyword are now
followed by either the "firstline" filter or the "websub" filter. When "websub"
is used, it always follows the "escape" filter.
2014-05-17 17:10:23 +08:00
Steven Brown
5f0b1e4110 tests: write the hgrc file for test-hgweb-commands.t with cat instead of echo
To improve the readability.
2014-05-17 17:09:46 +08:00
Steven Brown
3b270bc2bf tests: tests for the rss feeds
This matches the existing tests for the atom feeds.
2014-05-17 17:09:10 +08:00
Sean Farley
fcd9eb7e7d localrepo: use _matchstatus of context objects
Now that we have the machinery in place, we call the context method for
changing the match object in the case of comparing the working directory with
its parent.

This removes the last of the hard-coded workingctx knowledge in localrepo
paving the way for us to remove localrepo.status completely.
2014-04-23 15:54:26 -05:00
Sean Farley
42ad19b6f3 workingctx: override _matchstatus for parentworking case
This patch encapsulate the logic for changing the match.bad function when
comparing against the working directory's parent. Future patches will remove
more of the 'if ... else' blocks in localrepo.status that test for this working
directory parent case.
2014-04-24 08:32:28 -05:00
Sean Farley
7c49d1c079 basectx: add _matchstatus method for factoring out last of parentworking logic
This patch paves the way to allow a workingctx to override the match object
with a custom 'bad' method for cases where status is sent a directory pattern.
2014-04-23 15:39:30 -05:00
Sean Farley
884625aaa0 workingctx: use inheritance for _buildstatus while keeping the fastpath
This patch maintains the fast path for workingctx which is to not build a
manifest if the working directory is being compared to its parent since, in
this case, we can just copy the parent manifest.
2014-04-24 08:34:44 -05:00
Sean Farley
8fa5efef13 localrepo: remove unneeded unpacking of r
This unpacking is unneeded now because previous patches have removed the need
for this method to modify each of these variables in favor of passing the whole
set around to pre/post hook methods of the corresponding context object.
2014-04-22 19:06:37 -05:00
Sean Farley
37d0fb4ec7 localrepo: call _poststatus hook instead of hardcoding symlink knowledge 2014-04-22 13:02:38 -05:00
Sean Farley
463e9b93cd workingctx: add _poststatus method to call _filtersuspectsymlink
With this patch, we are one step closer to removing 'if ... else' logic in
localrepo.status for testing if the context is the working directory or
not. Future patches will replace those blocks of code with a call to the
context's _poststatus hook so that each context object will do the right thing
depending on the situation.
2014-04-22 12:59:22 -05:00
Sean Farley
8c39c57c3f context: add a no-op _poststatus method
This patch adds a private _poststatus method so that certain contexts, such as
workingctx, can add custom post-processing to status.
2014-04-22 12:51:58 -05:00
Sean Farley
c588a4ed8c localrepo: call _prestatus hook instead of hardcoding dirstate knowledge 2014-04-22 12:43:20 -05:00