Commit Graph

23945 Commits

Author SHA1 Message Date
Matt Harbison
c4eaa46278 subrepo: drop unused pattern initialization in hgsubrepo revert
This passed an empty list to filerevert() if '--all' was specified, otherwise
the set of modified files.  But then filerevert() immediately switched this and
reinitialized 'pats' to an empty list if '--all' was *not* specified.
2015-02-08 00:56:40 -05:00
Matt Harbison
ee0eea92e1 revert: display full subrepo output with --dry-run
Since the point of --dry-run is to show what will happen, the output with and
without it should agree.  And since revert wasn't being called on subrepos with
--dry-run before, revert in the subrepo had to be defanged in this case.
2015-02-07 21:47:28 -05:00
Matt Harbison
d3f2dde965 largefiles: don't warn when reverting a forgotten largefile
Previously, when a largefile is forgotten and then reverted, a warning was
issued:

   $ hg revert -R subrepo subrepo/large.txt
   file not managed: subrepo/large.txt (glob)

This was purely cosmetic as the file itself actually was reverted.

The problem was even with all of the matcher patching, the largefile pattern
given on the command line wasn't converted to a standin because the standin was
neither in ctx nor wctx.  This causes the named largefile to be added to the
'names' dict in cmdutil.revert() in the repo walk at line 2550.  The warning was
printed out when the 'names' dict is iterated, because the file was specified
exactly.

Since core revert recurses into subrepos and largefiles only overrides the
revert method in commands.py, it doesn't work properly when reverting a subrepo.
However, it still will recurse into the subrepo and call the installed matcher
method, so lfdirstate is reopened for the current repo level to prevent any new
problems.
2015-02-07 19:40:02 -05:00
Matt Harbison
ff672a242a subrepo: annotate addremove with @annotatesubrepoerror 2015-02-06 20:39:20 -05:00
Durham Goode
8504194a9f histedit: don't recreate state object
Previously, the histedit state object was being recreated during continue/abort.
This meant that the locks that were held on the original state object were not
available to actions, which meant actions could not release the lock on the
repository (like an 'exec' action would need to do).

This affected our internal extension that added the 'exec' action.
2015-02-17 19:59:26 -08:00
Anton Shestakov
dfeb532e8f hgweb: clearly outline <tr> block in paper/changeset.tmpl
This particular <tr> block should use the style of its neighboring blocks,
otherwise it's easy to think that the closing '</tr>' is missing.
2015-01-10 21:37:42 +08:00
Anton Shestakov
b6f79937e4 hgweb: don't mix tabs and spaces in monoblue templates 2015-01-10 19:58:28 +08:00
Anton Shestakov
97857afa7f hgweb: remove unneeded escaping in gitweb/map and monoblue/map
Elements in map files work slightly different from regular python strings, so
escaping single quotes is not necessary. It is also demonstrated by the very
same lines: '(current diff)'.

I should've made this in 3468fd599ef4, but here we go.
2015-01-10 19:43:07 +08:00
Yuya Nishihara
34b5e5774a resolve: port to generic templater
Test output changes because color labels are applied separately.
2015-02-11 13:59:13 +09:00
Yuya Nishihara
c9de8bb4f9 resolve: extract -l/--list operation from big loop
This prepares for porting to generic templater.  repo.wlock() and ms.commit()
should be unnecessary for "resolve -l".
2015-02-11 13:55:15 +09:00
Yuya Nishihara
ab0dd2e3c1 resolve: silence warning of unknown pats for -l/--list (BC)
It was introduced at 1e92106a20bc to warn that "hg resolve" did nothing
meaningful. The warning seems not good for "hg resolve -l" because it is
rather like "hg status" or "hg files".
2015-02-11 13:47:43 +09:00
Ryan McElroy
54e6a6adbc extensions: allow extending command synopsis and docstring
Mercurial uses a synopsis string and the docstring of a command for the
command's help output. Today  there is no way for an extension that adds
functionality to a command to extend either of these help strings.

This patch enables appending to both the doctring and the synopsis, and adds
a test for this functionality. Example usage is shown in the test and is also
described in the docstring of extensions.wrapcommand().
2015-02-09 11:02:45 -08:00
Mike Edgar
3562a06261 revlog: _addrevision creates full-replace deltas based on censored revisions
A delta against a censored revision is either received through exchange and
written blindly to a revlog, or it is created by the revlog itself. This
change ensures the latter process creates deltas which fully replace all
data in a censored base using a single patch operation.

Recipients of a delta against a censored base will verify that the delta is in
this full-replace format. Other recipients will use the delta as normal.

For background and broader design of the censorship feature, see:
http://mercurial.selenic.com/wiki/CensorPlan
2015-01-21 17:11:37 -05:00
Mike Edgar
0a639adee5 revlog: special case expanding full-replacement deltas received by exchange
When a delta received through exchange is added to a revlog, it will very
often be expanded to a full text by applying the delta to its base. If
that delta is of a particular form, we can avoid decoding the base revision.
This avoids an exception if the base revision is censored.

For background and broader design of the censorship feature, see:
http://mercurial.selenic.com/wiki/CensorPlan
2015-02-06 01:38:16 +00:00
Martin von Zweigbergk
1568f5ba1d test-merge-tools: fix flaky test by avoiding debugsetparents
debugsetparents is a debug command and does not provide the same
guarantees as non-debug commands do. In particular, when the user sets
a different parent, any clean files will remain clean in the dirstate
even though the new parent might have a different version of the file
(so it should appear modified compared to the new parent). Let's
instead achieve the same effect by updating to the new parent and
reverting the contents back to what they were.

This fix can be tested by passing '--config
debug.dirstate.delaywrite=2' to the 'hg update' command in the
beforemerge().
2015-02-10 16:17:15 -08:00
Mike Edgar
9635f8c5b0 revlog: in addgroup, reject ill-formed deltas based on censored nodes
To ensure interoperability when clones disagree about which file nodes are
censored, a restriction is made on deltas based on censored nodes. Any such
delta must replace the full text of the base in a single patch.

If the recipient of a delta considers the base to be censored and the delta
is not in the expected form, the recipient must reject it, as it can't know
if the source has also censored the base.

For background and broader design of the censorship feature, see:
http://mercurial.selenic.com/wiki/CensorPlan
2015-02-06 00:55:29 +00:00
Mike Edgar
af0ba8e839 mdiff: add helper for making deltas which replace the full text of a revision
This helper will be used initially for censor-aware delta generation. Deltas
which replace the full contents of the base revision are guaranteed to apply
correctly regardless of whether the delta recipient has censored the base.

For background and broader design of the censorship feature, see:
http://mercurial.selenic.com/wiki/CensorPlan
2015-01-21 16:35:09 -05:00
Mike Edgar
c736894d9c revlog: add "iscensored()" to revlog public API
The iscensored method will be used by the exchange layer to reject
nonconforming deltas involving censored revisions (and to produce
conforming deltas).

For background and broader design of the censorship feature, see:
http://mercurial.selenic.com/wiki/CensorPlan
2015-01-23 17:01:39 -05:00
Mike Edgar
fcc0e5645e filelog: allow censored files to contain padding data
To ensure delta compatibility, when a revision is censored, it is
padded to match the original data in size. The previous check does
not allow for padding because it was added before padding was found
to be a requirement.

For more background and design of the censorship feature, see:
mercurial.selenic.com/wiki/CensorPlan
2015-02-06 01:44:24 +00:00
Yuya Nishihara
4c1f7f24d7 revset: drop factory that promotes spanset to fullreposet
All callers use fullreposet where appropriate.

Backed out changeset 6c2c046ac382
2015-01-08 23:43:15 +09:00
Yuya Nishihara
878c8b67df revset: specify fullreposet without using spanset factory
The factory function will be removed because the subsequent patches will
make fullreposet(repo) not fully compatible with spanset(repo).
2015-01-08 23:46:54 +09:00
Yuya Nishihara
25fac1a15b revset: make match function initiate query from full set by default
This change is intended to avoid exposing the implementation detail to
callers. I'm going to extend fullreposet to support "null" revision, so
these mfunc calls will have to use fullreposet() instead of spanset().
2015-02-02 22:21:07 +09:00
Matt Harbison
179f83c3ed localrepo: don't reintroduce pruned tag entries when tagging
If a commit and a followup tag commit are pruned, there are no references to it
in any non obsolete version of .hgtags.  Without this change however, the next
time a tag is added to another branch, the obsolete references are appended in
.hgtags before the new entries for the current tag command.

The annotation to unfilter localrepo._tag() has been around since 3da49fd631fb.
The log message for it mentions computing the tag cache though, so I'm not sure
if this was misplaced?  It looks like branchmap was aware of filtering then, and
now tracks a cache per view.
2014-10-01 20:26:33 -04:00
Mateusz Kwapich
d8c405977d histedit: switch state to store node instead of ctx
Currently, if the node no longer exists, the state object fails to load
and pukes with an exception. Changing the state object to only store the
node allows callers to handle these cases.  For instance, in
bootstrapcontinue we can now detect that the node doesn't exist and exit
gracefully.

The alternative is to have the state object store something like None
when the node doesn't exist, but then outside callers won't be able to
access the old node for recovery (unless we store both the node and the
ctx, but why bother).

More importantly it allows us to detect this case when doing hg histedit
--abort.  Currently this situation results in both --continue and
--abort being broken and the user has to rm .hg/histedit-state to unwedge
their repo.
(description by Durham Goode)
2015-02-05 13:10:07 -08:00
Mateusz Kwapich
aa07ec44a0 histedit: don't allow to strip nodes which are necessary to continue histedit
During histedit we don't want user to do any operation resulting in
stripping nodes needed to continue history editing. This patch
wraps the strip function to detect such situations.
2015-01-30 16:47:35 -08:00
Martin von Zweigbergk
c2aa9ed527 trydiff: transpose 'if opts.git or losedatafn' with 'if f[12]'
Perhaps it's more readable this way...
2015-02-06 16:09:43 -08:00
Martin von Zweigbergk
f2001609be trydiff: extract function that generates filename pairs
The code that identifies copies/renames, as well as the filenames
before and after, is now isolated and we can extract it to a function
so it can be overridden by extensions (in particular the narrow clone
extension).
2015-01-22 23:29:00 -08:00
Martin von Zweigbergk
8e7eeafaf5 trydiff: read file data in only one place
This moves getfilectx() out of the initial block in the loop, leaving
that block to be only about finding pairs of filenames in ctx1 and
ctx2 to diff.
2015-01-22 23:18:43 -08:00
Martin von Zweigbergk
c5d80876e7 trydiff: set filename variables to None even when not opts.git or losedatafn
There is not much left of the first block "if opts.git or losedatafn"
block now. The next patch will move the call to getfilectx() out of
that block. We will then be using the defined-ness of 'f1' to tell
whether the file existed in ctx1 (and under what name). We will need
this information whether or not opts.git or losedatafn was set, so
just remove that guard. The only operation in the block that is not
cheap is the call to getfilectx(), but that has an extra 'if opts.git'
guard already.

--ignore-space-change proves that only 'if opts.git or losedatafn:'
  was removed.
2015-01-22 23:13:48 -08:00
Martin von Zweigbergk
ff03ae13d3 trydiff: read flags in one place
Now that we can trust f1/f2 to indicate whether that side of the diff
exists, we can move the calls to ctx.flag() to a single place.
2015-01-22 23:01:00 -08:00
Martin von Zweigbergk
5cac0e0289 trydiff: break 'if opts.git or losedatafn' into two
This moves the initialization 'binary' closer to its other assignment,
but exists mostly to simplify future patches.
2015-02-06 15:21:56 -08:00
Martin von Zweigbergk
03828692db trydiff: make filenames None when they don't exist
f1 and f2 are currently set always set to some filename, even for
added or deleted files. Let's instead set them to None to indicate
that one side of the diff doesn't exist. This lets us use the filename
variables instead of the content variables and simplify a bit since
the empty string is not a valid filename. More importantly, it paves
the way for further simplifications.
2015-01-22 22:42:35 -08:00
Augie Fackler
56de6b9a2a test-help: add test to demonstrate that 'hg help merge-tools' is sane 2015-02-10 10:57:58 -05:00
Gregory Szorc
bfb9e38893 help.merge-tools: do not double document merge tools
Merge tools were being double documented in help system output due
to functions being defined under multiple names in the merge tools
dictionary.

Establish a new dictionary for just the tools to document and
use it from the help system so we don't get double output.

Double documentation likely plagues other auto-documented items
as well. It might be a good idea to eventually compare function
instances to filter out duplicate entries from dictionaries
passed to ``makeitemsdoc``. However, without an easy way to break
ties, this may result in some functions being advertised over
their modern equivalents. This would be a noble patch series.
But it isn't one this author is willing to tackle at this time.
2015-02-09 23:07:39 -08:00
Gregory Szorc
2a9673b3df help: teach topic symbols how to dedent
When using docstrings for documenting symbols such as revsets,
templates, or hgweb commands, documentation likely has leading
whitespace corresponding to the indentation from the Python source
file.

Up until this point, the help system stripped all leading and
trailing whitespace and replaced it with 2 spaces of leading
whitespace. There were a few bad side-effects. First, sections
could not be used in docstrings because they would be indented
and the rst parser would fail to parse them as sections. Also,
any rst elements that required indentation would lose their
indentation, again causing them to be parsed and rendered
incorrectly.

In this patch, we teach the topic symbols system how to dedent
text properly. I argue this mode should be enabled by default.
However, I stopped short of changing that because it would cause
a lot of documentation reformatting to occur. I'm not sure if
people are relying on or wanting indentation. So, dedenting has
only been turned on for hgweb symbols. This decision should be
scrutinized.
2015-02-09 14:59:04 -08:00
Gregory Szorc
19908c11f2 webcommands: document "graph" web command 2015-02-06 22:25:40 -08:00
Gregory Szorc
84c9e68503 webcommands: document "archive" web command 2015-02-06 22:19:59 -08:00
Gregory Szorc
7a4c38aedb webcommands: document "filelog" web command 2015-02-06 22:11:54 -08:00
Gregory Szorc
164751c7a0 webcommands: document "annotate" web command 2015-02-06 22:08:30 -08:00
Gregory Szorc
46063b9658 webcommands: document "comparison" web command 2015-02-06 22:06:44 -08:00
Gregory Szorc
4543e0b0be webcommands: document "filediff" web command 2015-02-06 22:02:14 -08:00
Gregory Szorc
d8699a97c0 webcommands: document "summary" web command 2015-02-06 21:51:52 -08:00
Gregory Szorc
060baa099d webcommands: document "manifest" web command 2015-02-06 21:48:01 -08:00
Gregory Szorc
2d9a7685cf webcommands: document "changelog" web command 2015-02-06 21:39:15 -08:00
Gregory Szorc
bb7094c895 webcommands: document "file" web command 2015-02-06 21:26:53 -08:00
Gregory Szorc
e4e6ba61d1 webcommands: document "log" web command 2015-02-06 21:13:03 -08:00
Gregory Szorc
7c907b0b4b webcommands: document "shortlog" web command 2015-02-06 20:50:17 -08:00
Gregory Szorc
22d62d80ec webcommands: document "changeset" web command 2015-02-06 20:48:22 -08:00
Gregory Szorc
8ce448377a webcommands: document "tags" web command 2015-02-06 20:44:46 -08:00
Gregory Szorc
2885cfee5f webcommands: document "bookmarks" web command 2015-02-06 20:43:54 -08:00