Commit Graph

16068 Commits

Author SHA1 Message Date
Patrick Mezard
22a413e426 graphlog: restore FILE glob expansion on Windows
On platforms not supporting shell expansion, scmutil.match() performs glob
expansion on 'pats' arguments. But _matchfiles() revset calls match.match()
directly, bypassing this behaviour. To avoid duplicating scmutil.match(), a
secondary scmutil.matchandpats() is introduced returning both the match object
and the expanded inputs. Note the expanded pats are also needed in the fast
path, and will be used by --follow code path.
2012-02-25 22:11:34 +01:00
Patrick Mezard
b623e68723 glog: restore multiple --rev test lost in rebasing 2012-02-25 21:51:13 +01:00
Matt Mackall
26807610cb copies: remove checkdirs options
This removes the undocumented merge.followdirs option, which has
always been true.
2012-02-25 14:22:58 -06:00
Matt Mackall
aaf40ea1d9 copies: add docstring for mergecopies 2012-02-24 18:21:06 -06:00
Matt Mackall
7c3342ed27 addremove: return 1 if we failed to handle any explicit files 2012-02-24 16:52:32 -06:00
Matt Mackall
ee77ef5137 merge with stable 2012-02-24 16:16:48 -06:00
Patrick Mezard
7e644e8129 log: fix --follow FILE ancestry calculation
Currently, --follow FILE looks for a FILE filelog, scans it and collects
linkrevs and renames, then filters them. The problem is the filelog scan does
not start at FILE filenode in parent revision but at the last filelog revision.
So:
- Files not in the parent revision can be followed, the starting node is
  unexpected
- Files in the parent revision can be followed from an incorrect starting
  node.

This patch makes log --follow FILE fail if FILE is not in parent revision, and
computes ancestors of the parent revision FILE filenode.
2012-02-24 20:57:59 +01:00
Patrick Mezard
989dc3e20e test-glog: extend a test before fixing --follow issues
The changes add a lot of noise to the test output, I prefer to separate it from
the changes which are to be introduced by --follow fixes.
2012-02-24 20:56:18 +01:00
Matt Mackall
ea01a95d30 graft: use proper revisions for copy detection (issue3265) 2012-02-24 16:09:15 -06:00
Wagner Bruna
526cb26c72 convert: fix typos in error messages 2012-02-24 19:11:35 -02:00
Patrick Mezard
4dca114aca graphlog: paths/-I/-X handling requires a new revset
The filtering logic of match objects cannot be reproduced with the existing
revsets as it operates at changeset files level. A changeset touching "a" and
"b" is matched by "-I a -X b" but not by "file(a) and not file(b)".

To solve this, a new internal "_matchfiles(...)" revset is introduced. It works
like "file(x)" but accepts more than one argument and its arguments are
prefixed with "p:", "i:" and "x:" to be used as patterns, include patterns or
exclude patterns respectively.

The _matchfiles revset is kept private for now:
- There are probably smarter ways to pass the arguments in a user-friendly way
- A "rev:" argument is likely appear at some point to emulate log command
  behaviour with regard to filesets: they are evaluated for the parent revision
  and applied everywhere instead of being reevaluated for each revision.
2012-02-23 18:05:20 +01:00
Patrick Mezard
1b972fd9a8 graphlog: imitate log slowpath when inputs are explicit files 2012-02-23 17:55:07 +01:00
Patrick Mezard
bda40c8a55 graphlog: paths arguments must be or'ed 2012-02-23 17:54:42 +01:00
Patrick Mezard
811b39a49c test-check-code-hg: fix xargs exit status on OSX
When xargs subcommand invocation fails in a normal way, GNU xargs returns 123
and BSD one returns 1.
2012-02-23 17:46:57 +01:00
Martin Geisler
b8759cea3b largefiles: respect store.createmode and avoid extra file copy
Before, a tempfile was used to create a temp file was created with 600
permissions and the uploaded data was written into it. This file was
then *copied* to .hg/largefiles/<hash>.

We now simply use atomictempfile to write the data to a temp file with
the right permissions and then rename that into place.
2012-02-23 13:37:10 +01:00
Martin Geisler
61a444869a largefiles: respect store.createmode in basestore.get
This replaces another use of tempfile with atomictempfile. The problem
with tempfile is that it creates files with 600 permissions instead of
respecting repo.store.createmode.
2012-02-23 13:37:10 +01:00
Martin Geisler
c3f611d55c largefiles: use repo.store.createmode for new files in .hg/largefiles
Before, the mode was copied from the file in the working copy. This is
inconsistent with how Mercurial normally creates files inside the .hg
folder. This can lead to a situation where you can read the files
under .hg/store but not under .hg/largefiles and so a clone will fail
if it needs to access a largefile.
2012-02-23 13:22:55 +01:00
Patrick Mezard
41e01db02e graphlog: rewrite --rev like all other options 2012-02-23 11:21:30 +01:00
Patrick Mezard
ef23be02e3 graphlog: --branch and --only-branch are the same
Handling the aliasing in fancyopts would be cleaner but I do not want to make
this change for stable.
2012-02-23 11:21:04 +01:00
Matt Mackall
272058d456 mq: expand qimport summary 2012-02-22 17:41:22 -06: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
4798ea4198 localrepository: use 'changectx.dirs()' in 'status()' for directory patterns
when pattern which does not match against any files in working context
is specified, current implementation of 'localrepository.status()'
decides whether warning message about it should be shown or not by
'f not in context'

this works correctly for 'file pattern', but not for 'directory
pattern', because 'f not in context' always returns True for
directories, even if they are related to the context.

this patch uses 'changectx.dirs()' 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
7fa94e616c graphlog: multiple --keyword must be or'ed 2012-02-22 12:30:15 +01:00
Patrick Mezard
5be7a248ec graphlog: multiple --branch must be or'ed 2012-02-22 12:30:15 +01:00
Patrick Mezard
89b24bd8b3 graphlog: multiple --user must be or'ed 2012-02-22 12:30:15 +01:00
Patrick Mezard
a2ea7bb50f graphlog: explicitely join multivalue parameters
This will let use override the "join" value (and/or) depending on the option
considered. The option revset arity is now deduced from the revset and the
option value type, to simplify opt2revset definition.
2012-02-22 12:30:15 +01:00
Patrick Mezard
0d86e86816 test-glog.t: use printrevset extension to trace rewritten revsets
Using "hg log -G --print-revset" prints the revset generated by graphlog and
exits. This helps debugging and writing shorter tests.

It has been suggested to handle these tests with doctests. I think the
extension approach is better because:
- It tests the actual parameter set passed to graphlog.revset(), not what we
  expect it to be. 'branch' and 'only-branch' are currently distinct options
  but nothing prevents fancyopts to grow a notion of option aliasing one day,
  where both options would be merged before reaching the command.
- It can be used as debug output interleaved with real log calls.

v2:
- Use a test extension instead of a global deprecated new option
2012-02-22 12:30:14 +01:00
Matt Mackall
8ddc445e67 status: fix format field thinko 2012-02-22 15:22:12 -06:00
Dan Villiom Podlaski Christiansen
83af46e848 largefiles: don't break filesets 2012-02-20 17:59:48 +01:00
Michal Sznajder
1c1007a5ed help: sort hgrc related "Sections" chapters alphabetically 2012-02-18 14:27:57 +01:00
Patrick Mezard
eacdef0369 doc: minor fixes to [graph] section documentation 2012-02-18 12:30:24 +01:00
Patrick Mezard
20e5c736c0 patch: fuzz more aggressively to match patch(1) behaviour
The previous code was assuming a default context of 3 lines. When fuzzing, it
would take this value in account to reduce the amount of removed line from
hunks top or bottom. For instance, if a hunk has only 2 lines of bottom
context, fuzzing with fuzz=1 would do nothing and with fuzz=2 it would remove
one of those lines. A hunk with one line of bottom context could not be fuzzed
at all.  patch(1) has apparently no such restrictions and takes the fuzz level
at face value.

- test-import.t: fuzz/offset changes at the beginning of file are explained by
  the new fuzzing behaviour and match patch(1) ones. Patching locations are
  different but those of my patch(1) do not make a lot of sense right now
  (patched output are the same)

- test-import-bypass.t: more agressive fuzzing makes a patching supposed to
  fail because of context, succeed. Change the diff to avoid this.

- test-mq-merge.t: more agressive fuzzing would allow the merged patch to apply
  with fuzz, but fortunately we disallow this behaviour. The new output is
  kept.

I have not enough experience with patch(1) fuzzing to know whether aligning our
implementation on it is a good or bad idea. Until now, it has been the
implementation reference. For instance, "qpush" tolerates fuzz (test-mq-merge.t
runs the special case of pushing merge revisions where fuzzing is forbidden).
2012-02-13 17:22:35 +01:00
Patrick Mezard
39da9af001 patch: fix fuzzing of hunks without previous lines (issue3264)
When applying hunks such as:

  @@ -2,1 +2,2 @@
   context
  +change

fuzzing would empty the "old" block and make patchfile.apply() traceback.
Instead, we apply the new block at specified location without testing.

The "bottom hunk" test was removed as patch(1) has no problem applying hunk
with no context in the middle of a file.
2012-02-13 16:47:31 +01:00
Patrick Mezard
1be0e99fa3 patch: make hunk.fuzzit() compute the fuzzed start locations
- It moves hunks processing weirdness where it belongs
- It helps reusing said weirdness whenever fuzzit() is called, like during the
  actual hunk fuzzing.
2012-02-13 13:51:38 +01:00
Patrick Mezard
e783da0202 patch: fuzz old and new lines at the same time
In theory, the fuzzed offsets for old and new lines should be exactly the same
as they are based on hunk parsing. Make it true in practice.
2012-02-13 13:21:00 +01:00
Patrick Mezard
3141b1aa35 mq: make qimport --push push all imported patches (issue3130)
Only the first imported one was pushed.
2012-02-14 14:31:40 +01:00
Patrick Mezard
d410481c55 convert: tolerate spaces between splicemap parent ids (issue3203)
Splicemap lines are documented in hg help convert like:

  key parent1, parent2

but parsed like:

  key, parents = line.strip().rsplit(' ', 1)
  parents = parents.replace(',', ' ').split()

The rsplit() call was introduced to handle spaces in keys for the generic
mapfile format. Spaces can appear in svn identifiers since they contain path
components. This logic makes less sense with splicemap since svn identifiers
can also appear on the right side, even if it is a bit less likely. Given the
parsing is theorically broken, I would rather follow what is documented already
and is correct in the main case where all identifiers are hg hashes. Also,
using svn identifiers in a splicemap sounds difficult as they are not easily
accessible.
2012-02-15 11:21:24 +01:00
Idan Kamara
e771a65076 test-commandserver: flush stdout 2012-02-16 01:23:45 +02:00
Idan Kamara
1e4d0cc218 localrepo: clear _filecache on rollback (issue3261)
Files are being replaced by rollback but the corresponding data in localrepo
isn't actually updated for things like bookmarks, phases, etc. Then when
rollback is done, the cache is updated thinking it has the most up-to-date
data, where in fact it is still pre-rollback.

We clear _filecache to force everything to be recreated.
2012-02-16 01:21:34 +02:00
Idan Kamara
f729c0ef8a scmutil: update cached copy when filecached attribute is assigned (issue3263)
When assigning a new object to filecached properties, the cached object that
was kept in the _filecache map was still holding the old object.

By implementing __set__, we track these changes too and update the cached
copy as well.
2012-02-15 20:02:35 +02:00
Idan Kamara
351bf40844 cmdserver: invalidate the dirstate when running commands (issue3271)
The dirstate is invalidated separately outside of invalidate() which is
already being called (other callers of invalidate() seems to suggest the
separation is there for a reason).
2012-02-15 23:44:10 +02:00
Idan Kamara
11836c52b3 localrepo: reset _phasesdirty flag after writing 2012-02-15 23:49:15 +02:00
Patrick Mezard
a7eea871c8 import: handle git renames and --similarity (issue3187)
There is no reason to discard copy sources from the set of files considered by
addremove(). It was done to handle the case where a first patch would create
'a' and a second one would move 'a' to 'b'. If these patches were applied with
--no-commit, 'a' would first be marked as added, then unlinked and dropped from
the dirstate but still passed to addremove(). A better fix is thus to exclude
removed files which ends being dropped from the dirstate instead of removed.

Reported by Jason Harris <jason@jasonfharris.com>
2012-02-16 13:03:42 +01:00
Patrick Mezard
48bbc97548 context: make workingctx.forget() really warn about untracked files 2012-02-16 12:56:48 +01:00
FUJIWARA Katsunori
c3838f8d3f largefiles: check whether specified patterns are related to largefiles strictly
current 'lfiles_repo.status()' implementation examines whether
specified patterns are related to largefiles in working directory (not
to STANDIN) or not by NOT-EMPTY-NESS of below list:

    [f for f in match.files() if f in lfdirstate]

but it can not be assumed that all in 'match.files()' are file itself
exactly, because user may only specify part of path to match whole
under subdirectories recursively.

above examination will mis-recognize such pattern as 'not related to
largefiles', and executes normal 'status()' procedure. so, 'hg status'
shows '?'(unknown) status for largefiles in working directory unexpectedly.

this patch examines relation of pattern to largefiles by applying
'match()' on each entries in lfdirstate and checking wheter there is
no matched entry.

it may increase cost of examination, because it causes of full scan of
entries in lfdirstate.

so this patch uses normal for-loop instead of list comprehensions, to
decrease cost when matching is found.
2012-02-15 23:01:09 +09:00
Matt Mackall
3ec4361714 log: remove caching of all visited revisions (issue3253)
Not only does this eat all available memory for some users, it's slower.
2012-02-10 16:52:32 -06:00
Matt Mackall
31ad230c52 pull: backout change to return code
This bit a number of people.
2012-02-10 16:09:30 -06:00
Patrick Mezard
4fbe13b66c convert: use splicemap entries when sorting revisions (issue1748)
When sorting revisions before converting them, we have to edit the revision
graph using splicemap entries. Otherwise, a spliced revision may be converted
before its synthetic parents. Invalid splicemap revisions are now detected
before starting the conversion.
2012-02-10 22:34:13 +01:00