Commit Graph

11667 Commits

Author SHA1 Message Date
FUJIWARA Katsunori
350af37dc3 hgweb: show revisions and hashes gotten from changelog in "comparison" page
Before this patch, revision numbers and hash values in "comparison"
page are gotten from not changelog but filelog.

Such filelog information is useful only for hgweb debugging, and may
confuse users.

This patch shows revision numbers and hash values gotten from
changelog in "comparison" page.
2014-04-17 09:36:09 +09:00
FUJIWARA Katsunori
62dac3c633 hgweb: show as same parents as "hg parents -r REV FILE" in pages for file
Before this patch, "parents" in pages for file doesn't show as same
parents as "hg parents -r REV FILE", when the specified file is not
modified in the specified revision.

For example, it is assumed that revision A, B and D change file "f".

    changelog   (A) ---> (B) ---> (C) ---> (D)
    filelog "f" (x) ---> (y) ------------> (z)

"/file/D/f" invokes "webutil.parents()" with filectx(z) gotten from
changectx(D), and it returns changectx(B). This is as same result as
"hg parents -r D f".

In the other hand, "/file/C/f" invokes "webutil.parents()" with
filectx(y') gotten from changectx(C), and it returns changectx(A),
because filectx(y') is linked to changectx(B), and works like
filectx(y) in some cases.

In this case, revision B is hidden from users browsing file "f" in
revision C.

This patch shows as same parents as "hg parents -r REV FILE" in pages
for file, by making "webutil.parents()" return:

  - "linkrev()"-ed revision only, if:

    - specified context instance is "filectx" (because
      "webutil.parents()" is invoked with changectx, too), and

    - (1) the revision from which filectx is gotten and (2) the one to
      which filectx is linked are different from each other

  - revision gotten from "ctx.parents()", otherwise
2014-04-17 09:36:08 +09:00
FUJIWARA Katsunori
fc4364cead hgweb: make "comparison" get parent from not filelog but changelog
Before this patch, "comparison" shows unexpected result, when the
specified file is not modified in the specified revision, even though
"diff" shows empty result.

When REV doesn't change specified FILE, "diff" shows:

  "hg diff -c REV FILE"

but "comparison" shows:

  "hg diff -c `hg parents -r REV FILE` FILE"

In other words, the former gets parent from changelog, but the latter
gets one from filelog.

This may confuse users browsing (and switching "diff" and
"comparison" of) files in the specified revision.

This patch makes "comparison" get parent from not filelog but
changelog, to show "hg diff -c REV FILE" in both "diff" and
"comparison" pages.
2014-04-17 09:36:08 +09:00
FUJIWARA Katsunori
98201640e7 hgweb: fix lack of "bookmarks" link in "/file" page of "paper" style
This patch also fixes same problem of "coal" style, because it re-uses
"filerevision.tmpl" of "paper" style.

"gitweb" and "monoblue" styles don't have such problems.

"spartan" style doesn't have "bookmarks" page definition itself.
2014-04-17 09:36:08 +09:00
Aaron Jensen
2e9eed01a1 hgweb: adding article link to rss feed 2014-04-17 11:48:22 -07:00
Aaron Jensen
a849a70906 hgweb: adding branch names from inbranch template to rss feed 2014-04-17 11:47:49 -07:00
Aaron Jensen
4ecda29bda hgweb: adding branch names from inbranch template to atom feed 2014-04-17 11:45:43 -07:00
Matt Mackall
a34a093097 merge with stable 2014-07-09 12:30:12 -05:00
anatoly techtonik
1ed4ec4c3a version: show enabled extensions (issue4209)
This code is based by hg-versions extension (GPLv2)
by Markus Zapke-Gruendemann <info@keimlink.de>


http://mercurial.selenic.com/wiki/VersionsExtension
2014-06-10 13:44:37 +03:00
Ryan McElroy
2464893018 templater: introduce word function
This function allows returning only the nth "word" from a string. By default
a string is split as by Python's split() function default, but an optional
third parameter can also override what string the string is split by.
2014-06-12 18:02:23 -07:00
Sean Farley
6fe5bc8cca committablectx: move __contains__ into workingctx
This was mistakenly moved from workingctx to committablectx in
edbbc56a5e4f. Since the method is querying the dirstate, the only logical place
is for it to reside is in workingctx.
2014-07-03 23:01:37 -05:00
Sean Farley
274d2d46cf memctx: explicitly set substate to None
In 4c8873aad79a, memctx was changed to inherit from committablectx, this in
turn added the 'substate' property to memctx. It turns out that the
newcommitphase method tested for this property:

  def newcommitphase(ui, ctx):
      commitphase = phases.newcommitphase(ui)
      substate = getattr(ctx, "substate", None)
      if not substate:
          return commitphase

Currently, memctx isn't ready to handle substates, nor removed files, so we
explicitly must set substate=None to get the old behavior back. In the future,
we can decide how memctx should play with substate. For now, this fixes
third-party extensions and some internal code dealing with subrepos.
2014-07-02 15:24:43 -05:00
André Sintzoff
e960b46a33 util.h: declare dirstateTupleType variable instead of defining it
The definition is already in parsers.c

This patch avoids, at least on Mac OS X 10.6.8, build issue since 00dd020bc772
2014-07-03 19:05:04 +02:00
Sean Farley
5b08d55f04 memctx: add _manifest implementation that computes the filenode
This is an initial implementation of having a manifest for memctx that computes
the hash in the same way that filenodes are computed elsewhere.
2014-05-29 16:12:59 -05:00
Sean Farley
9f8a936835 basectx: pass raw context objects to patch.diff 2014-04-29 16:43:59 -05:00
Mads Kiilerich
eb39238a97 dirstate: report bad subdirectories as match.bad, not just a warning (BC)
This seems simpler and more correct.

The only test coverage for this is test-permissions.t when it says:
  dir: Permission denied
2013-10-03 18:01:21 +02:00
Mads Kiilerich
67a2ed988d dirstate: improve documentation and readability of match and ignore in the walker 2013-10-03 18:01:21 +02:00
Mads Kiilerich
c608411f0d context: remove redundant handling of match.bad return value
The 'bad' function is for reporting - it never returns anything.
2013-10-03 18:01:21 +02:00
Mads Kiilerich
3bb35d5e35 match: remove last traces of unused .missing callback 2013-10-03 18:01:21 +02:00
Mads Kiilerich
3811c637be match: _globre doctests 2014-04-13 22:00:08 +02:00
Mads Kiilerich
df98b5168a match: improve documentation - docstrings and more descriptive variable naming
No real changes.

pattern: 'kind:pat' as specified on the command line
patterns, pats: list of patterns
kind: 'path', 'glob' or 're' or ...
pat: string in the corresponding 'kind' format
kindpats: list of (kind, pat) tuples
2013-10-03 18:01:21 +02:00
Lucas Moscovicz
783ebe698d cmdutil: changed _makegraphlogrevset to _makelogrevset
This method will now be used to build both graphlog and log revset after this
series of patches.
2014-02-25 10:40:04 -08:00
Mads Kiilerich
cb0184290d revlog: backout 1c95c1863327 - commonancestors 2014-04-17 20:01:39 +02:00
Mads Kiilerich
2ffa0a82ac localrepo: use commonancestorsheads for checking linear heritage in file commit
If two revisions are linearly related, there will only be one ancestor, and
commonancestors and commonancestorsheads would give the same result.
commonancestorsheads is however slightly simpler, faster and more correct.
2014-04-17 20:01:39 +02:00
Mads Kiilerich
d2c13e7d3c backout: use commonancestorsheads for checking linear heritage
If two revisions are linearly related, there will only be one ancestor, and
commonancestors and commonancestorsheads would give the same result.
commonancestorsheads is however slightly simpler, faster and more correct.
2014-04-17 20:01:39 +02:00
Mads Kiilerich
1478c563ea revlog: introduce commonancestorsheads method
Very similar to commonancestors but giving all the common ancestors heads.
2014-04-17 20:01:35 +02:00
Mads Kiilerich
6ffb3587ef parsers: remove unnecessary gca variable in index_commonancestorsheads 2014-04-17 19:58:08 +02:00
Mads Kiilerich
b73865b95b parsers: introduce index_commonancestorsheads
This is an exact copy of index_ancestors but without the final "deepest"
pruning.
2014-02-24 22:42:14 +01:00
Mads Kiilerich
acc676f65f ancestors: extract candidates function as commonancestorsheads 2014-04-17 19:49:56 +02:00
Mads Kiilerich
638e3b7e24 filemerge: better handling of failing remove of temporary files
We have seen some failures on Windows that could seem like the unlinks of
temporary files were failing. That could perhaps be because the merge tool
somehow still held the files open.

Instead of the bare bone os.unlink, use our util.unlink with special
rename/retry handling on Windows.
2014-04-17 14:54:46 +02:00
FUJIWARA Katsunori
87f58fc092 obsolete: add '%' specifier to the format string to avoid TypeError at runtime
Mapping operation on the format string not including any '%'
specifiers causes TypeError at runtime.
2014-04-16 03:05:00 +09:00
Sean Farley
c813b41f60 patch: use ctx.node() instead of bare node variable
Future patches will allow patch.diff to take a basectx so node1 (and node2)
could make hexfunc error out. Instead, we'll call the node function on the
context object directly.
2013-08-14 13:10:27 -05:00
Matt Mackall
3fd77ddc42 merge with stable 2014-07-02 00:01:13 -05:00
Matt Mackall
8a748a627c dispatch: handle empty IOError args
We occasionally throw bare IOError objects (especially in convert),
don't choke on them.
2014-07-01 19:54:48 -05:00
Ryan McElroy
e3b09c4564 templater: add symbol to error
This patch makes it easier to debug writing templater functions by
telling the user exactly what was sent to the templater.
2014-06-12 18:07:21 -07:00
Ryan McElroy
f735b30979 templater: introduce startswith function
This function returns a string only if it starts with a given string.
It is particularly useful when combined with splitlines and/or used with
conditionals that fail when empty strings are passed in to take action
based on the contents of a line.
2014-06-12 17:53:37 -07:00
Ryan McElroy
9f5399cbcd templatefilter: add splitlines function
This is useful for applying changes to each line, and it's especially powerful
when used in conjunction with conditionals to modify lines based on content.
2014-06-12 17:45:41 -07:00
Yuya Nishihara
35e80dcc92 serve: tidy up indent level of repository not found message 2014-05-01 19:57:25 +09:00
Yuya Nishihara
2bdb976a60 serve: inline checkrepo() that is used only when --stdio is specified
Since 870f20f84f1a, --cmdserver is allowed to start without repository, so
checkrepo() function is meaningless.
2014-05-01 19:54:43 +09:00
Yuya Nishihara
5f56b9d6a6 serve: make sure to print "listening at" message immediately
If stdout is piped, status message won't be flushed until client connects to
the server and access log is written to stdout.  It seems bad idea to queue
start-up banner of server process.
2014-06-28 13:02:44 +09:00
Matt Mackall
73894d1463 merge with stable 2014-06-27 15:20:50 -07:00
Angel Ezquerra
621431257d tags: read tag info into a sorted dict (rather than into a regular dict)
This lets us preserve the original tag order (as specified on the .hgtags file
that is being read). This will be useful to preserve the tag order when saving
the result of a successful automated .hgtags merge (which will be introduced on
a future patch).

There shouldn't be much impact on performance because the sortdict that
_readtags returns is then used to update the alltags regular dict (which
remains a regular dict).
2014-02-23 03:13:21 +01:00
Angel Ezquerra
74f8eca049 config: move config.sortdict class into util
This makes it more natural to use the sortdict class from outside config.py.
2014-02-23 01:56:31 +01:00
Siddharth Agarwal
337e9e8db0 dirstate.status: assign members one by one instead of unpacking the tuple
With this patch, hg status and hg diff regain their previous speed.

The following tests are run against a working copy with over 270,000 files.
Here, 'before' means without this or the previous patch applied.

Note that in this case `hg perfstatus` isn't representative since it doesn't
take dirstate parsing time into account.

$ time hg status  # best of 5
before: 2.03s user 1.25s system 99% cpu 3.290 total
after:  2.01s user 1.25s system 99% cpu 3.261 total

$ time hg diff    # best of 5
before: 1.32s user 0.78s system 99% cpu 2.105 total
after:  1.27s user 0.79s system 99% cpu 2.066 total
2014-05-27 21:02:16 -07:00
Siddharth Agarwal
f40a94a790 parsers: inline fields of dirstate values in C version
Previously, while unpacking the dirstate we'd create 3-4 new CPython objects
for most dirstate values:

- the state is a single character string, which is pooled by CPython
- the mode is a new object if it isn't 0 due to being in the lookup set
- the size is a new object if it is greater than 255
- the mtime is a new object if it isn't -1 due to being in the lookup set
- the tuple to contain them all

In some cases such as regular hg status, we actually look at all the objects.
In other cases like hg add, hg status for a subdirectory, or hg status with the
third-party hgwatchman enabled, we look at almost none of the objects.

This patch eliminates most object creation in these cases by defining a custom
C struct that is exposed to Python with an interface similar to a tuple. Only
when tuple elements are actually requested are the respective objects created.

The gains, where they're expected, are significant. The following tests are run
against a working copy with over 270,000 files.

parse_dirstate becomes significantly faster:

$ hg perfdirstate
before: wall 0.186437 comb 0.180000 user 0.160000 sys 0.020000 (best of 35)
after:  wall 0.093158 comb 0.100000 user 0.090000 sys 0.010000 (best of 95)

and as a result, several commands benefit:

$ time hg status  # with hgwatchman enabled
before: 0.42s user 0.14s system 99% cpu 0.563 total
after:  0.34s user 0.12s system 99% cpu 0.471 total

$ time hg add new-file
before: 0.85s user 0.18s system 99% cpu 1.033 total
after:  0.76s user 0.17s system 99% cpu 0.931 total

There is a slight regression in regular status performance, but this is fixed
in an upcoming patch.
2014-05-27 14:27:41 -07:00
Siddharth Agarwal
64ffd83be6 dirstate: add dirstatetuple to create dirstate values
Upcoming patches will switch away from using Python tuples for dirstate values
in compiled builds.  Make that easier by introducing a variable called
dirstatetuple, currently set to tuple. In upcoming patches, this will be set to
an object from the parsers module.
2014-05-27 17:10:28 -07:00
Siddharth Agarwal
b0368f2bfe parsers: remove no longer used dirstate_unset 2014-05-27 15:22:23 -07:00
Siddharth Agarwal
a23ea931cf pack_dirstate: in C version, for invalidation set dict to what we write to disk
For files written out in the last second, Mercurial used to invalidate all the
stat data (state, size, mode, mtime) while persisting to disk. This included
invalidating the data in the dirstate dict as well.

In commit c7a2ac9361a7, this was found to be unnecessary, and Mercurial
switched to invalidating only the mtime. However, in the C version of
pack_dirstate the value set in the dict was still the fully invalidated one.

Switch to invalidating just the mtime in the dict as well.
2014-05-27 15:17:38 -07:00
Chinmay Joshi
b213bdb627 hg: update newly added listdir function of vfs in clone
This change invokes os.listdir() via newly added vfs function in clone.
2014-06-21 14:49:49 +05:30
Chinmay Joshi
23499031cc hg: use vfs functions in clone
This change applies vfs functions in clone. destvfs.exists will invoke
os.path.lexists via lexists of vfs to check for broken symbolic links.
2014-06-21 14:44:09 +05:30
Chinmay Joshi
79a112c77c hg: update util.writefile method to use write with vfs in share
This patch replaces util.writefile() to use destvfs.write().
2014-06-21 14:40:29 +05:30
Chinmay Joshi
25196ecc60 hg: update to use vfs functions in shared destination repository
This patch uses destvfs with base as .hg directory in shared destination
repository to update filesystem function with vfs. Some methods are changed to
use vfs functions with destvfs.

branch 'default' HG: bookmark '@' HG: changed mercurial/hg.py
2014-06-21 14:37:39 +05:30
Chinmay Joshi
e649f751d8 hg: use vfs functions in destination repository with share
In this patch, dstwvfs is added to use vfs functions in working directory of
destination shared repository. Existing filesystem operations are updated
to use vfs functions through dstwvfs.
2014-06-21 14:29:20 +05:30
Chinmay Joshi
0db86c64a5 vfs: add listdir for os.listdir in vfs
This patch adds listdir() in vfs to use os.listdir().
2014-06-20 21:18:14 +05:30
Augie Fackler
29ea24d6d3 templater: restore use of callable() since it was readded in Python 3.2 2014-06-23 09:24:56 -04:00
Augie Fackler
523e972164 hook: restore use of callable() since it was readded in Python 3.2 2014-06-23 09:24:38 -04:00
Augie Fackler
5b9ee2a71f help: restore use of callable() since it was readded in Python 3.2 2014-06-23 09:24:24 -04:00
Augie Fackler
d39e848921 extensions: restore use of callable() since it was readded in Python 3.2 2014-06-23 09:24:06 -04:00
Augie Fackler
bd7aa248d4 fancyopts: restore use of callable() since it was readded in Python 3.2 2014-06-23 09:24:16 -04:00
Stephen Lee
b831a97d01 diff: add nobinary config to suppress git-style binary diffs 2014-06-21 15:56:49 +10:00
Matt Mackall
9e74ea490c branchmap: don't use ui.warn for debug message 2014-06-23 13:50:44 -05:00
Matt Mackall
561e39d121 branch: add debug message for branch cache write failure 2014-06-23 13:46:42 -05:00
Gregory Szorc
21d0247021 commands: define inferrepo in command decorator 2014-05-04 22:22:59 -07:00
Gregory Szorc
aa3c5a1887 cmdutil: support inferrepo in command decorator 2014-05-04 22:20:00 -07:00
Gregory Szorc
0a46b331a5 commands: define optionalrepo in command decorator 2014-05-04 22:16:05 -07:00
Gregory Szorc
f5b841fd2e cmdutil: add optionalrepo argument to command decorator 2014-05-04 22:12:34 -07:00
Gregory Szorc
51b0c2ec81 commands: define norepo in command decorator 2014-05-04 20:57:01 -07:00
Gregory Szorc
a7f200b6b8 commands: add norepo argument to command decorator
Since decorators are evaluated at module load time and since the
@command decorator imports commands, the norepo variable (along with
its friends) may not be declared yet. These variables are now declared
before @command usage to ensure they are present.
2014-05-04 20:58:25 -07:00
Gregory Szorc
db0791767a cmdutil: better document command() 2014-05-04 18:45:04 -07:00
Matt Mackall
f3b0b8e4bb merge with stable 2014-06-18 20:59:36 -05:00
Matt Mackall
c3f187f7c4 bookmarks: improve the bookmark help (issue4244) 2014-06-18 15:26:07 -05:00
Matt Mackall
ff110a3353 merge with stable 2014-06-14 11:56:20 -05:00
Matt Mackall
f1d993bf16 merge with stable 2014-06-13 17:42:04 -05:00
Brendan Cully
84c737c817 error: restore python 2.4 compatibility for BundleValueError
Under python 2.4, this:
    super(BundleValueError, self).__init__(msg)
raises this:
    TypeError: super() argument 1 must be type, not classobj
2014-06-10 17:00:31 -07:00
Matt Mackall
36c70daf5c i18n: explicitly decode paragraphs
This was triggering an exception when the default encoding was disabled.
2014-06-12 14:40:45 -05:00
Matt Mackall
ceb82a6112 minirst: explicitly decode substitutions
Caught by Augie and sys.setdefaultencoding("undefined")
2014-06-13 14:14:02 -05:00
Pierre-Yves David
047a4db399 wireproto: rephrase the error message for unknown getbundle parameters
In case of an unknown parameter passed to ``getbundle``, the server prints a
message and ignores the parameter. This message was misleadingly prefixed with
"abort: ". The use of "abort: " here is clearly wrong as nothing is actually
aborted and the ``getbundle`` call proceeds without the parameter.

The message is now prefixed with "warning: " and rephrased to make it clearer
that the parameter was simply ignored.
2014-05-27 14:45:31 -07:00
Pierre-Yves David
52e1ca0858 status: document the content of the returned tuple in the docstring
The ``status`` function returns a lot of information. We document it.
2014-05-31 17:26:15 -07:00
Matt Mackall
140901211f resolve: fix grammar of no matching files message 2014-06-09 14:11:17 -05:00
Matt Mackall
3cb2ffc448 merge with stable 2014-06-09 13:53:23 -05:00
Yuya Nishihara
0215b66d65 workingctx: duplicate status list received at _poststatus hook
basectx.status may reorder the list after workingctx._poststatus is called,
so workingctx must copy it.  Otherwise, wctx.deleted() would return "unknown"
files, for example.
2014-05-31 21:21:06 +09:00
Chinmay Joshi
b97e831462 patch: replace functions in fsbackend to use vfs
Several functions in fsbackend are replaced to use vfs functions.
vfs operations are applied on filename and path is joined by _join().
2014-06-05 15:24:29 +05:30
Chinmay Joshi
ecc3ce679c vfs: add unlinkpath to vfs
This patch adds unlinkpath() function in vfs to replace util.unlinkpath().
2014-06-05 15:16:44 +05:30
FUJIWARA Katsunori
2b812d91a3 backout: accept '--edit' like other commands creating new changeset
After this patch, users can invoke editor for the commit message by
'--edit' option regardless of '--message'/'--logfile'.
2014-06-01 00:08:32 +09:00
Sean Farley
23ec6d1ff8 memfilectx: add a size method
This method is needed to have memfilectx behave like the other file
contexts. We can't just inherit this method because each file context has
different behavior: filectx reads from the filelog, and workingfilectx reads
from the disk. Therefore, we define memfilectx to return the size of the data
in memory.
2014-06-03 13:49:51 -07:00
Matt Mackall
ea918a9647 merge with stable 2014-06-01 16:01:01 -07:00
Matt Mackall
4bc583507d bundlerepo: backout 5d87516cc668
According to foozy:

This patch should be backed out, because "bundlename" and "bundle" in
this case are not relative paths to the root of repositories.

The former is specified via "hg incoming --bundle BUNDLENAME"
(relative path to cwd, or absolute one), and the latter is generated
in "changegroup.writebundle" by "tempfile.mkstemp" for internal
temporary usage (absolute path).

To be exact, the latter hunk in this patch can be applied, because
"os.join" for two absolute paths can generate correct result. But the
former hunk can't, because it may unexpected result, if specified path
is relative to cwd and cwd != root.
2014-05-30 11:53:10 -07:00
Pierre-Yves David
21bb02d08f merge: drop the quotes around commit description
We already have a ":" after the user name to denote the start of the
description. The current usage of quotes around the description is
problematic as the truncation to 80 chars is likely to drop the
closing quote. This may confuse syntax coloration in some editors.
2014-05-26 11:44:58 -07:00
Sean Farley
1757a6c91c memfilectx: remove path since it is now inherited 2013-08-15 15:47:15 -05:00
Sean Farley
48e74f2a7a memfilectx: remove __str__ since it is now inherited 2013-08-15 15:46:32 -05:00
Sean Farley
4c2ccc8f74 memfilectx: remove __nonzero__ since it is now inherited 2013-08-15 15:46:22 -05:00
Sean Farley
1002b6c612 memfilectx: call super.__init__ instead of duplicating code
This patch changes the calling signature of memfilectx's __init__ to fall in
line with the other file contexts.

Calling code and tests have been updated accordingly.
2013-08-15 16:49:27 -05:00
Sean Farley
ce51e4e299 memfilectx: inherit from committablefilectx
This patch marks the beginning of having memfilectx become a full-fledged file
contex so that we can handle diffing and merging.
2013-08-15 15:23:36 -05:00
Sean Farley
dab79b2875 memctx: remove parents since it is now inherited 2013-08-15 15:20:56 -05:00
Sean Farley
19ee0d9801 memctx: remove flags since it is now inherited
commitablectx has a much more robust implementation of flags() so we will use
that instead of just blindly calling the flags function for the given path.
2013-08-15 15:19:29 -05:00
Sean Farley
b313657e44 memctx: remove extra since it is now inherited 2013-08-15 15:17:05 -05:00
Sean Farley
c6c9260200 memctx: remove branch since it is now inherited 2013-08-15 15:14:47 -05:00
Sean Farley
5dad7e7445 memctx: remove clean since it is now inherited 2014-05-28 20:03:38 -05:00
Sean Farley
8901e63f4c memctx: remove ignored since it is now inherited 2014-05-28 20:03:29 -05:00
Sean Farley
72ed48fbf9 memctx: remove unknown since it is now inherited 2014-05-28 20:03:19 -05:00
Sean Farley
10ff60a8f2 memctx: remove deleted since it is now inherited 2013-08-15 15:13:14 -05:00
Sean Farley
06fb032978 memctx: remove removed since it is now inherited 2013-08-15 15:12:54 -05:00
Sean Farley
a5e383250e memctx: remove added since it is now inherited 2013-08-15 15:12:46 -05:00
Sean Farley
e1a50e2392 memctx: remove modified since it is now inherited 2013-08-15 15:12:31 -05:00
Sean Farley
3bb2b1b835 memctx: remove files since it is now inherited
This is a slight change in definition from memctx returning only modified() but
its parent's definition is more consistent with other contexts' behavior so we
can call this change a slight bugfix and step in the right direction.
2013-08-15 15:12:19 -05:00
Sean Farley
ff84134188 memctx: remove description since it is now inherited 2013-08-15 15:07:43 -05:00
Sean Farley
e20bb1e948 memctx: remove date since it is now inherited 2013-08-15 15:07:29 -05:00
Sean Farley
24ca8e9461 memctx: remove user since it is now inherited 2013-08-15 15:07:01 -05:00
Sean Farley
ef4723d1a0 memctx: remove p2 since it is now inherited 2013-08-15 15:06:39 -05:00
Sean Farley
ee101eac61 memctx: remove p1 since it is now inherited 2013-08-15 15:06:10 -05:00
Sean Farley
9609b1d01c memctx: remove __getitem__ since it is now inherited 2013-08-15 15:05:32 -05:00
Sean Farley
f9b7d78d04 memctx: remove __nonzero__ since it is now inherited 2013-08-15 15:04:55 -05:00
Sean Farley
4a1f5fc163 memctx: remove __int__ since it is now inherited 2013-08-15 15:04:36 -05:00
Sean Farley
a6facf0d7d memctx: remove __str__ since it is now inherited 2013-08-15 15:03:52 -05:00
Sean Farley
f37d45d609 memctx: call super.__init__ instead of duplicating code 2013-08-15 15:03:03 -05:00
Sean Farley
2b69f12f63 memctx: inherit from committablectx
This patch marks the start of having memctx inherit from committablectx,
thereby making it a full-fledged context that will eventually grow the ability
to perform diffing and also merging.
2013-08-15 15:00:03 -05:00
Sean Farley
f1efbc42f4 committablectx: fix _manifest doc string 2014-04-29 16:49:27 -05:00
Sean Farley
91eeee166f context: fix wrong indentation from renaming method 2014-05-29 16:09:16 -05:00
Pierre-Yves David
b483678287 push: use bundle2 to push phases when available
We now use a bundle2 container to push all phase updates at the same time. This
is a significant step forward, even if further refactoring is needed to unify
phase push with the changeset push.
2014-05-27 16:33:06 -07:00
Pierre-Yves David
c961ed1664 pushkey: add an `encode` function
This function is just a shorthand for ``encoding.fromlocal``. It will help
hiding the encoding business from other code exchanging pushkey data over the
wire.
2014-05-29 15:22:58 -07:00
Pierre-Yves David
f7baff1111 bundle2: add `pushkey` support
After ``listkeys`` we can now include ``pushkey`` request in a bundle2. The part
uses a very simple scheme closest as possible to the current wireproto command
for ``pushkey``. We may eventually decide for a more sophisticated part format
before the protocol becomes final.
2014-05-27 16:32:50 -07:00
Pierre-Yves David
97316a2345 pushkey: add a `decode` function
This function is just a shorthand for ``decoding.fromlocal``. It will help
hiding the encoding business from other code exchanging pushkey data over the
wire.
2014-05-29 15:23:25 -07:00
Pierre-Yves David
6a6d38b1b8 pull: when remote supports it, pull phase data alongside changesets
We use bundle2 to retrieve the remote phase data at the same time as
changesets. This reduces the amount of requestis and should improve consistency
as the server can ensure nothing changed between the retrieval of those parts.
2014-05-27 15:44:46 -07:00
Pierre-Yves David
deb72642b3 getbundle: support of listkeys argument when bundle2 is used
A new ``listkeys`` is supported by getbundle. It is a list of namespaces whose
content should be included in the bundle.

An appropriate entry has been added to the wireproto map of getbundle arguments
and a new bundle2 capability is advertised.

There are still no codes that request such parts in core mercurial.
2014-05-27 15:43:09 -07:00
Pierre-Yves David
a14e2297f0 getbundle: raise error if extra arguments are provided for bundle10
New arguments are most likely to be supported by bundle20 (and above) only.
2014-05-29 14:59:22 -07:00
Pierre-Yves David
c4d12e35a5 bundle: introduce a listkey handler
This makes it possible to handle listkeys-related data stored in a bundle2.
There are no producers yet.
2014-05-27 15:42:03 -07:00
Pierre-Yves David
57230c6e44 pull: split remote phases retrieval from actual application
We want to be able to retrieve phases information through bundle2. The logic to
apply remote phases will not change.
2014-05-27 15:29:08 -07:00
Pierre-Yves David
9ddf331cd4 wireproto: use pushkey.decodekey 2014-05-27 15:02:51 -07:00
Pierre-Yves David
1ff0f40ae5 pushkey: introduce an `decodekeys` function
This function provides a standardized way to exchange pushkey content over
the wire.
2014-05-27 15:00:20 -07:00
Pierre-Yves David
3b4a115178 wireproto: use pushkey.encodekey 2014-05-27 15:00:08 -07:00
Pierre-Yves David
80d71a6ab3 pushkey: introduce an `encodekeys` function
This function provides a standardized way to exchange pushkey content over
the wire.
2014-05-27 14:57:28 -07:00
Pierre-Yves David
95482f20ff getbundle: declare type of parameters
In addition to listing the expected options for ``getbundle``, we also list their
types and handle the encoding/decoding automatically. This should make it easier
for extensions to transmit additional information to getbundle.
2014-05-22 09:53:52 -07:00
Pierre-Yves David
8174979f47 bundle2: introduce a `caps20to10` function
This function factors the creation of appropriate entries to use in
``bundlecaps`` argument of ``getbundle``. This cleans up code calling
``getbundle`` and helps its usage in more part of the code.
2014-05-22 13:31:33 -07:00
Pierre-Yves David
c2721b6512 bundle2: introduce a bundle2caps function
The process of decoding remote bundle2caps blob into a dictionary is cumbersome.
We move it into a small helper function. This will clarify code that reads
bundle2 capabilities of peers and helps using it in new places.
2014-05-24 16:20:09 -07:00
Pierre-Yves David
ad6efcd2be exchange: reinsert comment in the right place
Unrelated new code was inserted between the original comment and the related
code block.
2014-05-22 12:58:07 -07:00
Matt Mackall
ba031d2d3b merge with stable 2014-05-29 15:41:16 -07:00
Pierre-Yves David
e60d3c1093 bundle2: raise BundleValueError error for stream level unsupported params
This ensures both consistency and smooth propagation over the wire.
2014-05-28 15:37:47 -07:00
Pierre-Yves David
ee9ac67c31 bundle2: support None parttype in BundleValueError
This will be used for errors at the stream level.
2014-05-28 16:46:58 -07:00
Pierre-Yves David
29c25aabd5 bundle2: ignore advisory part with unknown parameters
Advisory parts are advisory. If a handler exists but does not support the
proper parameters, we can safely ignore it.

Test has been updated to include this case.
2014-05-27 12:16:45 -07:00
Pierre-Yves David
da0446d1b9 bundle2: enforce all parameters in a part to be handled
Once we picked a handler, we check that all mandatory parameter keys are
properly supported. If not we raise an exception.

We added a test for this case.

The code now fails for any part with unknown mandatory parameters. We will
ignore such errors for advisory parts in a later changeset.
2014-05-27 12:01:00 -07:00
Pierre-Yves David
5b7edfc76e bundle2: declare supported parameters for all handlers
We now update all existing handlers with the supported parameters information.
2014-05-28 11:40:07 -07:00
Pierre-Yves David
3e4ee45f47 bundle2: make it possible to declare params handled by a part handler
If we are to enforce the mandatory aspect of parameter, we need a way to
discover what a handler supports. The best option we end up with is this a simple
declaration of known parameters at registration time.

We simply plug the list of parameters on the function object because Python lets
us do that and there is no benefit for a more complicated way.

One of the handlers is updated for example and testing.
2014-05-27 11:49:48 -07:00
Pierre-Yves David
1b80836a48 bundle2: support transmission of params error over the wire
We picked a null character to split each parameter during the transfer. This is
fragile if the same character is used in parameter name. However other
codes will already behave in a strange way in that case, so we are not
introducing any regression. A better format may be picked for the final
version of the protocol.
2014-05-28 15:57:23 -07:00
Pierre-Yves David
e625997ab5 bundle2: introduce a `params` attribute to BundleValueError
We'll first use it for unsupported mandatory parameters on parts.
2014-05-28 15:53:34 -07:00
Pierre-Yves David
72ac6a7248 bundle2: introduce a parttype attribute to BundleValueError
We will use the Exception for more that just unknown part type.
2014-05-28 15:51:19 -07:00
Pierre-Yves David
b5c6c1b880 bundle2: rename b2x:error:unknownpart to b2x:error:unsupportedcontent
This is a backward compatibility breakage per se. But bundle2 was explicitly
flagged as experimental, and this is one an error path anyway. So the worse
possible outcome from this change is to still have a crash but with a different
message.
2014-05-27 10:32:07 -07:00
Pierre-Yves David
d9f1652a77 bundle2: move exception classes into the error module
Exceptions should have known their place.
2014-05-28 15:31:05 -07:00
Pierre-Yves David
08bcb101f2 bundle2: rename UnknownPartError to BundleValueError
We are going to raise exceptions for a wider range of cases: unsupported
mandatory stream and part parameters.  We rename the exception with a wider
name.
2014-05-28 14:22:24 -07:00
Sean Farley
3692a2672f context: explicitly return a tuple
In the refactoring of removing localrepo.status, e283486177bd, we accidentally
changed the return type from a tuple to a list. Philosophically, this is
incorrect so we explicitly return a tuple again.
2014-05-27 17:04:48 -05:00
Pierre-Yves David
096f428e53 bundle2: expose mandatory params in a mandatorykeys attribute
We expose all keys that MUST be processed in ``part.mandatorykeys``. This makes
it much easier to access the information. Enforcement of the mandatory
parameters is coming in later changesets.
2014-05-23 20:23:54 -07:00
Pierre-Yves David
467e401b10 bundle2: use the new `part.params` dictionary
We use the new ``part.params`` dictionary to access the value of parameters instead of
creating one from the part's attributes.
2014-05-26 18:45:43 -07:00
Pierre-Yves David
75a728d5f5 bundle2: introduce a `params` dictionary on unbundled parts
This exposes all parameters the part received into a ``part.params`` dictionary.
This should be much easier to use.

This dictionary itself does not expose the mandatory or advisory aspect of
parameters, but no current users of bundle2 actually enforce any of this logic.
Coming changesets will improve this aspect.
2014-05-23 17:26:57 -07:00
Pierre-Yves David
ecdd6aaf9e bundle2: make sure unbundled part param are read-only
My old uncle Robert once trusted an API user. We never saw him again.
2014-05-23 17:17:39 -07:00
Pierre-Yves David
ee0bc34f9d bundle2: introduce an `_initparams` method
The handling of parameters will become much more sophisticated in the coming
changesets. So we extract the logic in a function to not pollute the generic
logic.
2014-05-28 10:04:02 -07:00
Pierre-Yves David
17c8c5b1eb bundle2: forbid duplicate parameter keys
No rules were specified about parameter key uniqueness. We document that keys
should be unique and document it. This opens the way to a more friendly (read
dictionary like) way to access value of parameters in the code.
2014-05-22 12:52:09 -07:00
Pierre-Yves David
7023ca67e5 bundle2: update part creators to `addparam` when relevant
In some cases, the use of ``addparam`` makes code much clearer.
2014-05-23 16:46:30 -07:00
Pierre-Yves David
76215be0d0 bundle2: introduce a `addparam` method on part
We make it easier to add new parameters after the part creation. As for the
``data`` attribute we make sure the part generation has not begun yet.
2014-05-22 11:38:40 -07:00
Pierre-Yves David
3c42f04f04 bundle2: the ability to set `data` attribute of the part is now official
We make it safe to set the data attribute after part creation. It is an allowed
operation as long as the part has not started to be generated.
2014-05-22 11:21:26 -07:00
Pierre-Yves David
2ece793be7 bundle2: introduce a ReadOnlyPartError exception
As we will introduce functions to alter already created parts, we need a proper
exception to raise when code tries to alter a part that cannot be altered anymore.
2014-05-24 16:08:05 -07:00
Pierre-Yves David
4248dc3512 bundle2: warn about error during initialization in `newpart` docstring
As we are moving toward being able to alter a part after its creation, we need
to make the implication of the part being already part of the bundle2 clear.
2014-05-23 16:20:30 -07:00
Pierre-Yves David
3b20774c58 bundle2: track life cycle of parts
We introduce a ``_generated`` attribute on parts. Coming changesets will
make it easier to update a part's contents after its creation. We need a way to track
if the part is still open to modification or if it is currently being generated
and should not be touched anymore.

As a bonus, we can now detect and crash if someone manages to write bogus code
to get a part generated twice.
2014-05-22 11:14:02 -07:00
Pierre-Yves David
121338752e bundle2: update all `addpart callers to newpart`
The new method is what we want in all current cases.
2014-05-23 15:59:19 -07:00
Pierre-Yves David
a618942ce3 bundle2: have `newpart` automatically add the part to the bundle
The created part is automatically added to the bundle as this is most certainly
the intent of the user code.
2014-05-23 15:54:18 -07:00
Pierre-Yves David
637e050d21 bundle2: add a `newpart method to bundle20`
Creating new parts is the most common operation people do when exposed to a
bundler. We create a dedicated method on the bundler object for it. This will
simplify the code and also avoid having to import the ``mercurial.bundle2``
module in multiple places.

One part creators have been updated for testing purpose.
2014-05-23 15:45:46 -07:00
Pierre-Yves David
6480c98ec3 bundle2: small doc update on the bundler
The `bundle20` class contains methods to help define the content and methods
to generate the actual stream. We add small doc headers to help distinguish
between the two.
2014-05-22 10:48:37 -07:00
Sean Farley
10c800bea9 localrepo: replace status method with a shim
The path of the righteous man is beset on all sides by the inequities of the
selfish and the tyranny of evil men. Blessed is he, who in the name of charity
and good will, shepherds the weak through the valley of darkness, for he is
truly Mercurial's keeper and the finder of robust methods. And I will strike
down upon thee with great vengeance and furious anger those who would attempt
to poison and destroy Mercurial's codebase. And you will know my name is the
Lord when I lay my vengeance upon thee.
2014-04-25 15:44:55 -05:00
Sean Farley
927e6572f4 workingctx: have status method call super instead of customized code.
The old code is unneeded now that basectx has the ability to calculate the
status between two context objects.

Now, we use the objected oriented pattern called 'super'.
2014-05-27 15:55:35 -07:00
Sean Farley
7d4925ec2b basectx: copy localrepo.status method
Now that all the pieces are in place, we copy the status method from
localrepo. In the next few patches, we will remove the old implementation.
2014-04-24 18:07:42 -05:00
Sean Farley
6a40a50483 committablectx: cache _status in _poststatus
A future patch will remove the old workingctx.status which caches the status of
the working directory, therefore we now cache this status in the poststatus
hook of committablectx.
2014-04-24 17:42:53 -05:00
Sean Farley
da54d7ddc4 committablectx: simplify caching the status
Previously, workingctx had custom variables for the unknown, ignored, and clean
list of files of status. These then got moved to committablectx and, after the
refactoring of localrepo.status, are no longer needed. We, therefore, simplify
the whole mess.

As a bonus, we are able to remove the need for having 'assert'.
2014-04-24 17:31:20 -05:00
Sean Farley
b948452671 localrepo: remove cache code now handled by _prestatus
This patch removes the last of the 'working' variable that was sprinkled
throughout localrepo.status which paves the way for future patches to use the
object oriented design of contexts to handle calculating the status.
2014-04-23 16:08:20 -05:00
Sean Farley
c4a16ba6c8 workingctx: add note about super._prestatus calling manifest 2014-04-23 16:06:42 -05:00
Sean Farley
ff42938c33 basectx: preserve loading the cached manifest in _prestatus
This is just a copy from localrepo.status and is a small step to removing that
method entirely. The prestatus hook is only called for changectx's, thereby
ensuring that the same behavior is guaranteed.
2014-04-23 16:06:23 -05:00
Sean Farley
24d42ebd09 localrepo: use new subrev method of context.py
With the machinery in place, we use context.subrev instead of testing for a
workingctx directly. This allows more flexibility for later patches that will
add memctx to the mix.
2013-09-20 21:59:34 -05:00
Sean Farley
9882a9e5a4 committablectx: add subrev method to return None
This allows a future patch to use object oriented style to remove an if
statement in the status method.
2013-09-20 22:07:58 -05:00
Sean Farley
ede9f80137 basectx: add subrev method to return the rev of a subrepo given a subpath
This will be used in an upcoming patch to simplify the status method by
eliminating an if block.
2013-09-20 21:55:42 -05:00
Matt Mackall
95a0ecfb91 merge with stable 2014-05-27 17:41:20 -07:00
Stephen Lee
05934f0bb8 discovery: if a push would create a new head, mention the bookmark name if any 2014-03-08 19:02:39 +11:00
Pierre-Yves David
ca87e2a8ca revert: use p2 as parent when reverting against it
revert was always using p1 as parent. This created some minor misbehavior when
reverting against p2. See test change for an example of that.

This is also a useful cleanup for coming refactoring to revert.
2014-05-14 10:38:05 -07:00
Pierre-Yves David
f11f5d8bf7 revert: explicitly get status against the parent
This makes absolutely no functional changes. The default value for
node1 is already the same as the current value of parent. But to be
able to properly use the second parent in merge context, we have to
start to be a bit more explicit about what we compute the status
against.
2014-05-14 10:37:25 -07:00
Pierre-Yves David
ffa305346b revert: group related data in tuple in the dispatch table
The dispatch table used to be:

- action if in target manifest
- action if not in target manifest
- make backup if in target manifest
- make backup if not in target manifest

We turn this into two (action, make backup) tuples.

This helps both readability of the dispatch table and handling of each case.

This also prepares a refactoring where the different actions we performs, whether
"file is in target manifest" or not, are determined before reaching this loop.
2014-05-13 17:28:19 -07:00
Pierre-Yves David
e48f0c2bb9 revert: group action into a single dictionary
We had 4 different variables to hold the list of the 4 possibles
actions. I'm grouping them in a single dictionary for a few reasons.
First, it makes it clearer they are all related and meant to be the
final actions performed by revert. Second this simplifies the parameter
of the _performrevert function. Finally the two elements in each entry
(list and message) have a different consumers in different functions,
this change will make it easier to split them in a later commit.
2014-05-13 16:42:31 -07:00
Pierre-Yves David
04aa6b354e revert: add some inline comments
I spend some time understanding how this part of the revert code is
working. I'm adding some comments to help the code readability. I
expect most of them to disappear in a coming refactoring. But the
refactoring should be easier to follow with the comment.
2014-05-13 16:29:42 -07:00
Pierre-Yves David
2b188dd25a revert: cosmetic align of the dispatch table
This changeset make a minimal cosmetic change to help readability of the value
in this table.
2014-05-13 16:29:20 -07:00
Chinmay Joshi
46bebd3c8d vfs: add lexists() in current api
lexists is added in current API of vfs.
2014-05-27 23:02:05 +05:30
Chinmay Joshi
94883ecab3 bundlerepo: update unlink in getremotechanges to use vfs
As per WindowsUTF8 plan, unlink from getremotechanges is updated to use vfs in this change.
2014-05-27 21:56:03 +05:30
Matt Mackall
d4f9291927 merge with stable 2014-05-26 18:16:23 -07:00
Pierre-Yves David
29c52cf0eb exchange: drop dead code
This code have been factorised and moved in its own function by 45df6ae67061. We
actually read the result of this other computation in the very line before the
deleted block.  I somehow forgot to remove the original code, but it is now
dead. Good bye duplicated computation.
2014-05-22 16:27:16 -07:00
Pierre-Yves David
493f2320e5 exchange: fix indentation level 2014-05-22 13:39:55 -07:00
Pierre-Yves David
b7c330c46d import: add --partial flag to create a changeset despite failed hunks
The `hg import` command gains a `--partial` flag. When specified, a commit will
always be created from a patch import. Any hunk that fails to apply will
create .rej file, same as what `hg qimport` would do. This change is mainly
aimed at preserving changeset metadata when applying a patch, something very
important for reviewers.

In case of failure with `--partial`, `hg import` returns 1 and the following
message is displayed:

    patch applied partially
    (fix the .rej files and run `hg commit --amend`)

When multiple patches are imported, we stop at the first one with failed hunks.

In the future, someone may feel brave enough to tackle a --continue flag to
import.
2014-05-08 17:08:17 -07:00
Mads Kiilerich
8244be3a60 update: introduce --tool for controlling the merge tool
Update is a kind of merge and may also need a merge tool and should have the
options described in the merge-tools help.
2014-05-19 01:53:34 +02:00
Mads Kiilerich
609d92f9c5 merge: fix stupid indentation left over from previous refactorings 2014-05-02 01:09:14 +02:00
Augie Fackler
bb57f51c4a Merge with stable 2014-05-26 12:39:31 -04:00
Mads Kiilerich
cb358d8d03 merge: use separate lists for each action type
This replaces the grand unified action list that had multiple action types as
tuples in one big list. That list was iterated multiple times just to find
actions of a specific type. This data model also made some code more
convoluted than necessary.

Instead we now store actions as a tuple of lists. Using multiple lists gives a
bit of cut'n'pasted code but also enables other optimizations.

This patch uses 'if True:' to preserve indentations and help reviewing. It also
limits the number of conflicts with other pending patches. It can trivially be
cleaned up later.
2014-02-28 02:25:58 +01:00
Siddharth Agarwal
265738b91b resolve: don't abort resolve -l even when no merge is in progress
This broke some internal automation that was quite reasonably checking for
unresolved files as a way to determine whether a merge happened cleanly. We
still abort for resolve --mark etc.
2014-05-23 13:10:31 -07:00
Durham Goode
18580a4620 update: specify custom conflict markers for update (BC)
Add custom conflict markers 'working copy' and 'destination' for doing hg update
when there are conflicts between your working copy and the destination.
2014-05-09 18:09:11 -07:00
Durham Goode
a9b7b0e4e8 help: add local/other description to merge tool description
Adds a more detailed description of what 'local' and 'other' mean to the merge
tool documentation.
2014-05-16 13:15:07 -07:00
Durham Goode
653de51193 graft: customize graft conflict markers (BC)
Changes the graft conflict markers to be 'graft' and 'local' to make it
more intuitive which side is which.
2014-05-09 18:15:02 -07:00
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
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