Commit Graph

4822 Commits

Author SHA1 Message Date
Yuya Nishihara
6e575010bd children: don't pass filectx to displayer
displayer doesn't want a fctx but a ctx. It failed with -Tdefault template.

    Traceback (most recent call last):
      ...
      File "mercurial/templatekw.py", line 212, in showbookmarks
        bookmarks = args['ctx'].bookmarks()
    AttributeError: 'filectx' object has no attribute 'bookmarks'
2015-03-26 23:56:18 +09:00
Laurent Charignon
601ebc9422 shelve: add interactive mode
This allows us to shelve selectively part of the changes of the workdir
2015-03-25 15:53:30 -07:00
Laurent Charignon
ea953c7452 shelve: add interactive mode command line option 2015-03-25 15:52:28 -07:00
FUJIWARA Katsunori
5359d785ec largefiles: remove useless overrideupdate
Now, "overrideupdate()" wrapping "hg update" is useless, because
"workingctx.dirty() and raising Abort" in "hg update" was replaced by
"cmdutil.bailifchanged()" in the previous patch, and the latter can
detect changes of largefiles in the working directory.
2015-03-25 13:55:35 +09:00
FUJIWARA Katsunori
9592a103f7 cmdutil: allow bailifchanged to ignore merging in progress
In "commands.update()", "cmdutil.bailifchanged()" isn't used for
"abort if the working directory is dirty", because it forcibly
examines about merging in progress.

"workingctx.dirty()" used in "commands.update()" can't detect changes
of largefiles in the working directory without "repo.lfstatus = True"
wrapping. This is only reason of "commands.update()" wrapping by
largefiles extension.

On the other hand, "cmdutil.bailifchanged()" already wrapped by
largefiles extension can detect changes of largefiles.

This patch is a preparations for replacing "workingctx.dirty()" and
raising Abort in "commands.update()" by "cmdutil.bailifchanged()". It
can remove redundant "commands.update()" wrapping.
2015-03-25 13:55:35 +09:00
FUJIWARA Katsunori
e269967115 subrepo: add bailifchanged to centralize raising Abort if subrepo is dirty
This patch also centralizes composing dirty reason message like
"uncommitted changes in subrepository 'xxxx'".
2015-03-25 13:55:35 +09:00
Martin von Zweigbergk
5adcba3667 revert: evaluate filesets against working directory (issue4497)
As the failing revert tests in test-fileset-generated.t show,

Revert currently creates one matcher for matching files in the working
copy and another matcher for matching files in the target
revision. The two matchers are created with different contexts, which
means filesets are evaluated differently. Then the union of the sets
of files matching the matchers in the two contexts are reverted. It
doesn't seem to make sense to use two different matchers; only the
context they're applied to should be different.

It seems very likely that the user wants the filesets to be evaluated
against the working directory, which the tests
test-fileset-generated.t also assume, so let's make it so.

I willingly admit that the largefiles code was modified by trial and
error (according to tests).
2015-03-23 23:04:51 -07:00
Martin von Zweigbergk
0ff6b06eb6 largefiles: extract and reuse 'standin' variable in overriderevert() 2015-03-24 10:27:56 -07:00
Martin von Zweigbergk
08b24c9159 largefiles: override cmdutil.revert() instead of comands.revert()
By overriding the cmdutil method we don't need to override both the
function and the command. Also, we get access to the 'ctx' and
'parents' variables, which will soon prove useful.

Rename the 'ctx' argument to overridematch() to 'mctx' rather than
letting it shadow new 'ctx'.
2015-03-20 10:05:31 -07:00
Martin von Zweigbergk
b6498bafba largefiles: fix typo with s/__class/__class__/
Commit 359818e9961c (largefiles: don't create chain of __contains__
calls, 2015-03-11) introduced a typo with __class instead of
__class__. Let's fix it.

There are (obviously) no tests covering this code path, and I could
not figure out a way to trigger it, so it remains untested.

Spotted by Drew Gottlieb.
2015-03-23 17:07:25 -07:00
Mads Kiilerich
c8659cbb76 convert: optimize convert of files that are unmodified from p2 in merges
Conversion of a merge starts with p1 and re-adds the files that were changed in
the merge or came unmodified from p2. Files that are unmodified from p1 will
thus not be touched and take no time. Files that are unmodified from p2 would be
retrieved and rehashed. They would end up getting the same hash as in p2 and end
up reusing the filelog entry and look like the p1 case ... but it was slow.

Instead, make getchanges also return 'files that are unmodified from p2' so the
sink can reuse the existing p2 entry instead of calling getfile.

Reuse of filelog entries can make a big difference when files are big and with
long revlong chains so they take time to retrieve and hash, or when using an
expensive custom getfile function (think
http://mercurial.selenic.com/wiki/ConvertExtension#Customization with a code
reformatter).

This in combination with changes to reuse filectx entries in
localrepo._filecommit make 'unchanged from p2' almost as fast as 'unchanged
from p1'.

This is so far only implemented for the combination of hg source and hg sink.

This is a refactoring/optimization. It is covered by existing tests and show no
changes - which is a good thing.
2015-03-19 17:40:19 +01:00
Siddharth Agarwal
ae273dc918 keyword: monkeypatch patch.diff more generically
This function doesn't need access to any of the args or kwargs, so make the
monkeypatching more robust. (In upcoming patches we'll introduce another
argument to patch.diff, and this function would break if it weren't for this
patch.)
2015-03-17 15:33:34 -07:00
Siddharth Agarwal
7383237886 keyword: rename kw_diff to kwdiff in keeping with Mercurial style rules
In an upcoming patch we'll change this function's signature. If the name is
kept the same, test-check-commit-hg.t complains.
2015-03-17 15:52:28 -07:00
Yuya Nishihara
bbf743afcb fetch: use an abort hint where appropriate 2015-03-17 20:36:33 +09:00
Yuya Nishihara
efaf86bce6 eol: replace "working copy" with "working directory" in extension help 2015-03-17 20:41:52 +09:00
Yuya Nishihara
610665ea76 commands: say "working directory" in full spelling 2015-03-17 21:53:17 +09:00
Yuya Nishihara
53f1e7866c commands: replace "working copy" with "working directory" in help/messages
"working directory" is the standard term, we should use it consistently.

But I didn't touch the hint, "run 'hg update' to get a working copy", because
"get a working directory" sounds a bit odd.
2015-03-17 22:47:08 +09:00
Mike Edgar
995a7fa51f censor: add censor command to hgext with basic client-side tests
The censor command is a core extension which can replace the contents of a
historical file revision with a censor "tombstone" which can be exchanged
with older clients in place of the real revision data. The command rewrites
the filelog by copying revision-by-revision.

Care must be taken to expand the fulltext of the children of the censored
revision before copying them to the new filelog; they might be stored as
deltas against the uncensored revision, and those deltas will be invalidated.

For more background on the censorship feature design, see:
http://mercurial.selenic.com/wiki/CensorPlan
2015-03-15 21:52:17 -04:00
Matt Harbison
82c07b771f largefiles: replace 'ctx._repo' with 'ctx.repo()' 2015-03-12 23:08:16 -04:00
Augie Fackler
21638a3adf convert: adjust progress bar for octopus merges (issue4169)
For merges, we walk the files N-1 times, where N is the number of
parents. This means that for an octopus merge with 3 parents and 2
changed files, we actually fetch 6 files. This corrects the progress
output of the convert command when such commits are encountered.
2015-03-12 21:41:50 -04:00
Laurent Charignon
8e36c9d449 record: change interface of dorecord to accept new filters
This makes it easier to add different filtering logic (record /crecord ...)
2015-03-11 16:39:38 -07:00
Laurent Charignon
d98e8547de record: make record use commit -i 2015-03-11 15:54:11 -07:00
Jordi Gutiérrez Hermoso
8eb132f5ea style: kill ersatz if-else ternary operators
Although Python supports `X = Y if COND else Z`, this was only
introduced in Python 2.5. Since we have to support Python 2.4, it was
a very common thing to write instead `X = COND and Y or Z`, which is a
bit obscure at a glance. It requires some intricate knowledge of
Python to understand how to parse these one-liners.

We change instead all of these one-liners to 4-liners. This was
executed with the following perlism:

    find -name "*.py" -exec perl -pi -e 's,(\s*)([\.\w]+) = \(?(\S+)\s+and\s+(\S*)\)?\s+or\s+(\S*)$,$1if $3:\n$1    $2 = $4\n$1else:\n$1    $2 = $5,' {} \;

I tweaked the following cases from the automatic Perl output:

    prev = (parents and parents[0]) or nullid
    port = (use_ssl and 443 or 80)
    cwd = (pats and repo.getcwd()) or ''
    rename = fctx and webutil.renamelink(fctx) or []
    ctx = fctx and fctx or ctx
    self.base = (mapfile and os.path.dirname(mapfile)) or ''

I also added some newlines wherever they seemd appropriate for readability

There are probably a few ersatz ternary operators still in the code
somewhere, lurking away from the power of a simple regex.
2015-03-13 17:00:06 -04:00
Augie Fackler
087f03a71a cvsps: use a different tiebreaker to avoid flaky test
After adding some sneaky debug printing[0], I determined that this
test flaked when a CVS commit containing two files starts too close to
the end of a second, thus putting file "a" in one second and "b/c" in
the following second. The secondary sort key meant that these changes
sorted in a different order when the timestamps were different than
they did when they matched. As far as I can tell, CVS walks through
the files in a stable order, so by sorting on the filenames in cvsps
we'll get stable output. It's fine for us to switch from sorting on
the branchpoint as a secondary key because this was already the point
when we didn't care, and we're just trying to break ties in a stable
way. It's unclear to be if having the branchpoint present matters
anymore, but it doesn't really hurt to leave it.

With this change in place, I was able to run test-convert-cvs over 650
times in a row without a failure.  test-convert-cvcs-synthetic.t
appears to still be flaky, but I don't think it's *worse* than it was
before - just not better (I observed one flaky failure in 200 runs on
that test).

0: The helpful debug hack ended up being this, in case it's useful to
future flaky test assassins:

 --- a/hgext/convert/cvsps.py
 +++ b/hgext/convert/cvsps.py
 @@ -854,6 +854,8 @@ def debugcvsps(ui, *args, **opts):
              ui.write(('Branch: %s\n' % (cs.branch or 'HEAD')))
              ui.write(('Tag%s: %s \n' % (['', 's'][len(cs.tags) > 1],
                                    ','.join(cs.tags) or '(none)')))
 +            if cs.comment == 'ci1' and (cs.id == 6) == bool(cs.branchpoints):
 +                ui.write('raw timestamp %r\n' % (cs.date,))
              if cs.branchpoints:
                  ui.write(('Branchpoints: %s \n') %
                           ', '.join(sorted(cs.branchpoints)))
2015-03-13 14:20:13 -04:00
Martin von Zweigbergk
a1eb6206a3 largefiles: don't create chain of __contains__ calls
Matt Harbison pointed out that my recent cdf4a99e1657 might cause
__contains__ to continously get replaced by another version that calls
itself, since the manifest instance returned by the super method is
always the same instance due to @propertycache. He also suggested
replacing the class instead, as is done with the context class in the
surrounding code. Do so.
2015-03-11 21:36:48 -07:00
Laurent Charignon
00e39c0a37 record: add interactive option to the commit command 2015-03-11 15:22:04 -07:00
Martin von Zweigbergk
47ac0996a7 largefiles: replace manifestdict.__contains__, don't extend class
We're soon going to add an alternative manifest class
(treemanifest). Rather than extending both those classes by
largesfiles versions, let's replace the method on the manifest
instances.
2015-03-09 17:13:22 -07:00
Laurent Charignon
b5de5559b7 record: move dorecord from record to cmdutil
Part of a serie of patches to move record from hgext to core
2015-03-10 17:14:33 -07:00
Laurent Charignon
e4283d0dfb record: remove dependency on hg module in record
Part of a series of patches to move record from hgext to core
2015-03-10 17:09:07 -07:00
Laurent Charignon
c30de5b61f record: remove dependency on extensions module in dorecord
Part of a series of patches to move record from hgext to core
2015-03-10 17:03:40 -07:00
Laurent Charignon
742d78e9af record: move filterpatch from record to patch
Part of a series of patches to move record from hgext to core
2015-03-10 14:42:07 -07:00
Siddharth Agarwal
8e295dc1a9 patch.internalpatch: add a default value for prefix
Rev cb4d72125aae adding a parameter here. This breaks third-party extensions
like crecord and also makes the issue fairly hard to fix on the extension's
side if it wants to retain compatibility across Mercurial versions -- in old
versions, the positional argument will be passed into the next unknown
argument, which is 'files'.

The patch also undoes a change to the record extension that is no longer
necessary.
2015-03-10 17:34:42 -07:00
Durham Goode
e49196de24 histedit: remove extra histedit constructor call
In a previous commit we removed the extra histedit object instance being
constructed in --continue and --abort. The new --edit-todo missed this fix
though (which means the state object it produces doesn't have the locks on it).
It's not breaking anything now, but let's go ahead and clean that up before we
forget.
2015-03-11 07:19:55 -07:00
Jordi Gutiérrez Hermoso
715eecf927 color: consolidate cut-and-paste code
This fixes a mild case of cut-and-paste code regarding failing to set
terminal modes. This is evident in the win32 comment that is misplaced
for the terminfo mode since cset 1456f081d00e.

Instead, we refactor this C&P into a small local function.
2015-03-11 09:34:22 -04:00
Laurent Charignon
39d2901c91 record: move parsepatch from record to patch
Part of a series of patches to move record from hgext to core
2015-03-09 13:16:25 -07:00
Laurent Charignon
18e7b1d4da record: move scanpatch from record to patch
Part of a series of patches to move record from hgext to core
2015-03-09 13:14:31 -07:00
Laurent Charignon
b8126743d5 record: move hunk class from record to patch
Part of a series of patches to move record from hgext to core
2015-03-09 13:09:15 -07:00
Laurent Charignon
ccb2a5f8f4 record: move countChanges in the hunk class
Part of a series of patches to move record from hgext to core
2015-03-09 13:08:19 -07:00
Laurent Charignon
3b17682474 record: move header class from record to patch
Part of a series of patches to move record from hgext to core
2015-03-09 13:04:50 -07:00
Siddharth Agarwal
f5f1d70d92 patch.internalpatch: accept a prefix parameter 2015-03-06 22:43:47 -08:00
Jordi Gutiérrez Hermoso
a24b7fe425 color: omit terminfo/win32 warning if non-interactive (issue4543)
It's pretty annoying to be getting this warning when already the
colour extension has no hope of working. If there isn't a human on the
other end to to see the colours, there probably isn't a human either
who cares about this warning. More likely, some script somewhere is
gonna get confused with the warning output.

Of course, if we still want to see the warning for some reason, we can
always set --config ui.interactive=True.
2015-03-10 13:40:14 -04:00
Laurent Charignon
e0bce75a1d record: allow editing new files (issue4304)
While using the record extension to select changes, the user couldn't see the
content of newly added files and had to select/reject them based on filename.
The test is changed accordingly in two places.
2015-03-06 15:57:43 -08:00
Anton Shestakov
638673ec74 histedit: use better meta-variable names than VALUE in help text
Before this change hg help histedit would use the default variable label:

    --commands VALUE
...
 -r --rev VALUE [+]

With this change the text will be in the usual help text style and a bit more
explanatory:

    --commands FILE
...
 -r --rev REV [+]
2015-03-09 14:32:17 +08:00
Anton Shestakov
23b1ae0b86 histedit: tweak --commands help text
The rest of help messages for command arguments are simple phrases without any
ending punctuation, so having this text be a complete sentence didn't really
fit.
2015-03-09 14:10:42 +08:00
Matt Harbison
410372aa73 largefiles: report the source of copied/moved largefiles in status -C
Previously, the source was silently skipped because the largefile was in the
list of changed files, but the standin was in the copies dictionary.  The source
is only displayed if the changed file is a key in the copies dictionary.
2015-01-25 02:45:49 -05:00
Matt Harbison
fd12e02a30 largefiles: handle logging from outside the repo
It's probably possible to refactor so that the 'if m._cwd' check isn't
necessary, but the False case is the typical case (i.e. run from the root of the
repo), and simpler to read.

An exact path to a largefile from outside the repo was previously ignored.

match.rel('.hglf') will handle figuring out both the correct '../' length to the
standin directory if inside the repo, or path/to/repo from outside, at the cost
of a pconvert() to keep the patterns using '/' on Windows.
2015-03-01 18:35:29 -05:00
Matt Harbison
f9602d9506 largefiles: don't prefix standin patterns with '.hglf' when logging
When logging '.hglf/foo', the pattern list was being transformed from
['.hglf/foo'] into ['.hglf/foo', '.hglf/.hglf/foo'].  Aside from the
pathological case of somebody getting a directory named '.hglf' created inside
the standing directory, the old code shouldn't have had any bad effects.

(amended by mpm to sort patterns for test stability and not upset check-code)
2015-03-01 14:21:54 -05:00
Matt Harbison
7b3baed62d largefiles: teach log to handle patterns
Adding the standin to the patterns list was (possibly) harmless before, but was
wrong, because the pattern list was already updated above that code.  Now that
patterns are handled, it was actually harmful.  For example, in this test:

    $ hg log -G glob:**another*

the adjusted pattern list would have been:

    ['glob:**another*', '.hglf/.', 'glob:.hglf/**another*']

which causes every largefile in the root to be matched.


I'm not sure why 'glob:a*' picks up the rename of a -> b commit in test-log.t,
but a simple 'a' doesn't.  But it doesn't appear to be caused by the largefiles
extension.
2015-02-28 23:42:38 -05:00
Yuya Nishihara
74fe7e4a0f graphlog: do not bypass commands.log so that -fr works
Since 1c6485ced49b, opts dict can be modified in commands.log() before calling
cmdutil.graphlog().
2015-03-04 21:47:07 +09:00
Mateusz Kwapich
0ddde4bfd1 histedit: add a config allowing changing histedit rule line length limit
Since many users are using terminals wider than 80 chars there should be an
option to have longer lines in histedit editor.

Even if the summary line is shorter than 80 chars after adding action line
prefixes (like "pick 7c2fd3b9020c") it doesn't fit there anymore. Setting
it to for example 110 would be a  nice option to have.
2015-01-21 14:45:24 -08:00