Commit Graph

261 Commits

Author SHA1 Message Date
Patrick Mezard
036643538d update: make --check abort with dirty subrepos
Aka "we could use dirty() but... yeah let's use it"
2012-04-23 12:12:04 +02:00
Patrick Mezard
82044cab98 context: revert workingctx.ancestors() followfirst option
It was introduced by mistake in df40a7c0d6aa.
2012-04-11 11:29:12 +02:00
Matt Mackall
35b009e3d3 context: use rev for changelog lookup
Faster when we're doing numeric scanning
2012-04-08 12:38:08 -05:00
Matt Mackall
3a03c51f0d context: internalize lookup logic
This allows us to avoid doing rev->node->rev lookups on silly
instances like "0", which end up caching the whole nodemap.
2012-04-08 12:38:07 -05:00
Matt Mackall
560dd93d34 merge with stable 2012-04-06 15:18:14 -05:00
Patrick Mezard
f535cae825 context: make changectx.mutable() benefit from .phase() logic
This fixes "hg qimport -r null". Previous versions used to:
- Traceback because null revision mutability was not defined
- Add an empty -1.diff patch to the series

The error message:

  abort: revision -1 is not mutable

is symptomatic of a deeper problem in phase command revision handling. It could
be fixed easily in the command itself but I feel a better fix must be done in
phase API which raises the issue of phase updates atomicity: aborting in
phases.advanceboundary/retractboundary requires a better rollback behaviour to
avoid partial changes.
2012-04-05 19:15:23 +02:00
Patrick Mezard
57671f9108 context: add followfirst arg to filectx and workingfilectx
When _followfirst() revset was introduced it seemed to be the sole user of such
an argument, so filectx.ancestors() was duplicated and modified instead. It now
appears this argument could be used when computing the set of files to be
considered when --patch or --stat are passed along with --follow FILE.
2012-02-26 17:10:57 +01:00
Matt Mackall
72210502d5 merge with stable 2012-02-22 17:36:33 -06:00
FUJIWARA Katsunori
4a78e2a3a1 context: use 'changectx.dirs()' in 'walk()' for directory patterns
this patch uses 'changectx.dirs()' instead of nested loop, to examine
whether specified pattern is related to the context as a directory or not.
2012-02-23 00:07:54 +09:00
FUJIWARA Katsunori
a4ea09aa29 context: add 'dirs()' to changectx/workingctx for directory patterns
this patch adds 'dirs()' to changectx/workingctx, which returns map of
all directories deduced from manifest, to examine whether specified
pattern is related to the context as directory or not quickly.

'workingctx.dirs()' uses 'dirstate.dirs()' rather than building
another copy of it.
2012-02-23 00:07:54 +09:00
Patrick Mezard
48bbc97548 context: make workingctx.forget() really warn about untracked files 2012-02-16 12:56:48 +01:00
Matt Mackall
ee1d294b90 merge with stable 2012-02-16 16:40:29 -06:00
Matt Mackall
e3a172f2f0 merge: don't use unknown()
This removes use of unknown files for building the synthetic working
directory manifest used by manifestmerge. Instead, we adopt the
strategy used by _checkunknown.

Side-effect: unknown files are no longer moved by remote directory
renames, and now are left alone like ignored files.
2012-02-09 17:04:17 -06:00
David M. Carr
560a2fff89 forget: fix subrepo recursion for explicit path handling
When support for handling explicit paths in subrepos was added to the forget
command (155b89136ae7), subrepo recursion wasn't taken into account.  This
change fixes that by pulling the majority of the logic of commands.forget into
cmdutil.forget, which can then be called from both there and subrepo.forget.
2012-01-17 19:10:59 -05:00
Matt Mackall
8985b466e0 merge with stable 2012-01-15 18:00:01 -06:00
Christian Ebert
4fcf579deb filectx: typo in comment 2012-01-15 13:39:09 +01:00
Yuya Nishihara
0bf3f9f6fd filectx: fix cmp() of file starting with '\1\n'
If file data starts with '\1\n', it will be escaped in the revlog to
create an empty metadata block, thus adding four bytes to the size in
the revlog size index. There's no way to detect that this has happened
in filelog.size() faster than decompressing each revision [1].

For filectx.cmp(), we have the size of the file in the working directory
available. If it differs by exactly four bytes, it may be this case, so
do a full comparison.

 [1]: http://markmail.org/message/5akdbmmqx7vq2fsg
2012-01-12 00:49:45 +09:00
Matt Mackall
e0479875b3 merge with stable 2012-01-13 11:29:53 -06:00
Pierre-Yves David
8cf1ba5eea phases: add a phasestr method on context 2011-12-29 04:40:09 +01:00
Pierre-Yves David
5262f88500 phases: store phase values in constant instead of using raw integer
Phases constant are named after the phase name. Usage of integer have been
replaced by proper constant.
2012-01-06 09:51:35 +01:00
Laurens Holst
8daae4999d context: add isbinary function 2011-12-21 18:20:15 +01:00
Matt Mackall
3044265f69 windows: recompute flags when committing a merge (issue1802)
Before this patch, Windows always did the wrong thing with exec bits
when committing a merge: consult the flags in first parent.

Now we manually recompute the result of merging flags at commit time,
which almost always does the right thing (except when there are
conflicts between symlink and exec flags).

To do this, we:

- pull flag synthesis out into its own function
- delay building this function unless it's needed
- add a merge case that compares flags in local and other against the ancestor

This has been tested in multiple ways on Linux:

- running the whole test suite with both old and new code in place,
  checking for differences in each flags() result
- running the whole test suite while comparing real on-disk flags
  against synthetic ones for merges
- test-issue1802 (from Martin Geisler) which disables exec bit
  checking on Unix
2011-10-22 16:12:33 -05:00
Pierre-Yves David
051b2da122 phases: implement `phase() and hidden()` method for workingctx
Working ctx don't have revision number and need a dedicated implementation.
2011-12-21 23:56:15 +01:00
Pierre-Yves David
164efe3ee5 phases: add a mutable boolean property on context 2011-12-19 23:31:38 +01:00
Patrick Mezard
cc3315778f annotate: support diff whitespace filtering flags (issue3030)
splitblock() was added to handle blocks returned by bdiff.blocks() which differ
only by blank lines but are not made only of blank lines. I do not know exactly
how it could happen but mdiff.blocks() threshold behaviour makes me think it
can if those blocks are made of very popular lines mixed with popular blank
lines. If it is proven to be wrong, the function can be dropped.

The first implementation made annotate share diff configuration entries. But it
looks like users will user -w/b for annotate but not for diff, on both the
command line and hgweb. Since the latter cannot use command line entries, we
introduce a new [annotate] section duplicating the diff whitespace options.
2011-11-18 12:04:31 +01:00
Pierre-Yves David
aa9ca9ca1c phases: improve context.phase()
* force recompute of outdated cache
* handle nullrev case
2011-11-07 18:37:58 +01:00
Pierre-Yves David
cbc7e13374 phases: add a phase method to context 2011-10-18 18:25:53 +02:00
Matt Mackall
b662345d91 match: allow passing a context object to match core 2011-06-18 16:52:51 -05:00
Matt Mackall
3ca86d272f context: add a match builder method
This is groundwork for matching against filesets in contexts
2011-06-18 16:52:51 -05:00
Pierre-Yves David
2b4856c921 hidden: Add `hidden` method for context 2011-06-16 01:57:59 +02:00
Patrick Mezard
97b28ace29 memctx: simplify constructor 2011-06-04 15:20:49 +02:00
Adrian Buehlmann
7062c2db6e workingctx: eliminate remove function
Inlining it into it's last remaining call place in cmdutil.copy.

Note that cmdutil.copy is called with the wlock already held, so no additional
locking is needed to call util.unlinkpath.

We do not need to wrap the util.unlinkpath call into a try block, because
at that point we already know whether abssrc exists or not -- thanks to the
preceding util.copyfile call. Adding a new local 'srcexists' in cmdutil.copy
for that purpose.
2011-06-02 00:33:33 +02:00
Adrian Buehlmann
a216345ef2 workingctx.remove: use self.forget 2011-05-27 21:11:44 +02:00
Matt Mackall
c6e850b04b context: make forget work like commands.forget
Switch users of wctx.delete(..., False) to forget.
2011-05-26 17:15:35 -05:00
Matt Mackall
97c6e7b48d dirstate: rename forget to drop
It has substantially different semantics from forget at the command
layer, so change it to avoid confusion.

We can't simply combine it with remove because we need to explicitly
drop non-added files in some cases like commit.
2011-05-26 17:15:35 -05:00
Adrian Buehlmann
5872a76fa2 workingctx.remove: don't stat files again after unlinking
we already know at this point that they have been unlinked
2011-05-24 14:52:23 +02:00
Adrian Buehlmann
2fa6cdd315 workingctx: unlink paths while holding the wlock 2011-05-24 14:08:20 +02:00
Matt Mackall
2f3e73a448 context: provide an efficient iterator for workingctx
This avoids needing to call status or build a synthetic manifest.
2011-05-01 08:29:50 -05:00
Idan Kamara
762d333ae9 eliminate various naked except clauses 2011-04-23 00:51:25 +03:00
Adrian Buehlmann
fc7e20743c add: introduce a warning message for non-portable filenames (issue2756) (BC)
On POSIX platforms, the 'add', 'addremove', 'copy' and 'rename' commands now
warn if a file has a name that can't be checked out on Windows.

Example:

  $ hg add con.xml
  warning: filename contains 'con', which is reserved on Windows: 'con.xml'
  $ hg status
  A con.xml

The file is added despite the warning.

The warning is ON by default. It can be suppressed by setting the config option
'portablefilenames' in section 'ui' to 'ignore' or 'false':

  $ hg --config ui.portablefilenames=ignore add con.xml
  $ hg sta
  A con.xml

If ui.portablefilenames is set to 'abort', then the command is aborted:

  $ hg --config ui.portablefilenames=abort add con.xml
  abort: filename contains 'con', which is reserved on Windows: 'con.xml'

On Windows, the ui.portablefilenames config setting is irrelevant and the
command is always aborted if a problematic filename is found.
2011-04-19 12:42:53 +02:00
Matt Mackall
d4af650e6a filectx: introduce p1/p2 convenience methods 2011-04-04 16:21:57 -05:00
Matt Mackall
ec99e4f807 ancestor: rewrite to deal with crossed linkrevs (issue2682)
This version is about 10% slower, possibly because it visits some
revisions in a different topological order than what's in the revlog.
2011-03-07 15:44:43 -06:00
Matt Mackall
8f5a9db068 context: be even more careful about result order in ancestors() (issue2642)
The earlier patch could be confused by more complicated topologies.
2011-02-25 15:31:32 -06:00
Kevin Bullock
7c7c788a0e workingctx: overload bookmarks() to return parents' bookmarks
This implements workingctx.bookmarks() parallel to workingctx.tags(),
overloading the implementation from changectx.
2011-02-23 20:47:00 -06:00
Matt Mackall
7bcb1a26b9 context: generate file ancestors in reverse revision order (issue2642)
The related() function in copies assumes that revisions are generated
in reverse revision order, so it was getting confused in some situations.
2011-02-23 17:27:05 -06:00
Martin Geisler
4009f00b54 remove unnecessary list comprehensions
These result lists were only built for the side effects, and so a
normal loop is just as good and more straight-forward.
2011-02-03 10:31:17 +01:00
David Soria Parra
9a6f3a9ae7 context: add method to return all bookmarks pointing to a node 2011-02-11 19:36:15 +01:00
Adrian Buehlmann
721e368ac1 rename util.unlink to unlinkpath 2011-01-02 19:34:41 +01:00
Matt Mackall
8b31da4540 branch: operate on branch names in local string space where possible
Previously, branch names were ideally manipulated as UTF-8 strings,
because they were stored as UTF-8 in the dirstate and the changelog
and could not be safely converted to the local encoding and back.

However, only about 80% of branch name code was actually using the
right encoding conventions. This patch uses the localstr addition to
allow working on branch names as local strings, which simplifies
handling so that the previously incorrect code becomes correct.
2010-11-24 15:56:32 -06:00
Martin Geisler
6a3d9310ab code style: prefer 'is' and 'is not' tests with singletons 2010-11-22 18:15:58 +01:00