Commit Graph

408 Commits

Author SHA1 Message Date
FUJIWARA Katsunori
36e9e8107c dirstate: fix some problems for recursive case normalization (issue3342)
file in nested directory causes unexpected abort.

problems below should be fixed for recursive normalization route in
dirstate._normalize():

    1. rsplit() may cause unpacking into more than 2 elements.
       it should be called with 'maxsplit' argument to unpack
       into 'd, f'

    2. 'd' is replaced by normalized value prefixed with
       'self._root', but this makes 'folded' as absolute path,
       and it is unexpected one for caller of recursive
       normalization
2012-03-31 15:55:03 +09:00
FUJIWARA Katsunori
dba1f40821 dirstate: avoid normalizing letter case on icasefs for exact match (issue3340)
on icasefs, "hg qnew" fails to import changing letter case of filename
already occurred in working directory, for example:

    $ hg rename a tmp
    $ hg rename tmp A
    $ hg qnew casechange
    $ hg status
    R a
    $

"hg qnew" invokes 'dirstate.walk()' via 'localrepository.commit()'
with 'exact match' matching object having exact filenames of targets
in ones 'files()'.

current implementation of 'dirstate.walk()' always normalizes letter
case of filenames from 'match.files()' on icasefs, even though exact
matching is required.

then, files only different in letter case are treated as one file.

this patch prevents 'dirstate.walk()' from normalizing, if exact
matching is required, even on icasefs.

filenames for 'exact matching' are given not from user command line,
but from dirstate walk result, manifest of changecontext, patch files
or fixed list for specific system files (e.g.: '.hgtags').

in such case, case normalization should not be done, so this patch
works well.
2012-03-31 00:04:08 +09:00
Matt Mackall
b7a9e07a8c dirstate: normalize case of directory components
If we have an existing f/a, and rename f to F, adding F/b should be
normalized to f/b.
2012-03-28 19:24:13 -05:00
FUJIWARA Katsunori
71230ee2e8 icasefs: use case preserved root for 'util.fspath()' invocation (issue3302)
path to repo root may contains case sensitive part, even though repo
is located in case insensitive filesystem: e.g. repo in FAT32 device
mounted on Unix.

so, case normalized root causes failure of stat(2).

this patch uses case preserved root for 'util.fspath()' invocation to
avoid this problem.

case preserved root for 'util.fspath()' may decrease efficiency of
fspath cache, but 'util.fspath()' is currently called only from
dirstate, so this fix has less impact.
2012-03-15 00:46:37 +09:00
Idan Kamara
653ad0c355 dirstate: filecacheify _ignore (issue3278)
This still doesn't handle the case where a command is run with
--config ui.ignore=path since we only look for changes in .hgignore.
2012-03-01 17:49:59 +02:00
Idan Kamara
ca3ebc8b96 dirstate: filecacheify _branch
The opener is relative to .hg, use it in a subclass of filecache to compute
the final path.
2012-03-01 17:42:49 +02:00
Idan Kamara
8fa8539f01 dirstate: add filecache support 2012-03-01 17:39:58 +02: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
Matt Mackall
0fb748c56c merge with stable 2012-01-09 20:16:57 -06:00
Martin Geisler
ba8731035e Use explicit integer division
Found by running the test suite with the -3 flag to show places where
we have int / int division that can be replaced with int // int.
2012-01-08 18:15:54 +01:00
Pierre-Yves David
cbc6c76868 dirstate: propagate IOError other than ENOENT when reading branch 2012-01-06 07:37:59 +01:00
FUJIWARA Katsunori
055136813d icasefs: avoid normcase()-ing in util.fspath() for efficiency
'dirstate._normalize()', the only caller of 'util.fspath()', has
already normcase()-ed path before invocation of it.

normcase()-ed root can be cached on dirstate side, too.

so, this patch changes 'util.fspath()' API specification to avoid
normcase()-ing in it.
2011-12-16 21:09:40 +09:00
FUJIWARA Katsunori
167dff84e5 dirstate: prevent useless util.fspath() invocation for '.'
at first of dirstate.walk() on case insensitive filesystem,
normalization of '.' causes util.fspath() invocation, but '.' is not
cached in it.

this invocation is not only useless, but also harmful: initial "hg
tag" causes creation of ".hgtags" file after dirstate.walk(), and
looking up ".hgtags" in cache will fail, because directory contents of
root is already cached at util.fspath() invocation for '.'.
2011-12-16 21:09:40 +09:00
Matt Mackall
14399ab3d4 dirstate: use util.normcase to build foldmap 2011-11-22 17:26:31 -06:00
Matt Mackall
3eab62750e dirstate: fix case-folding identity for traditional Unix
We used to use os.path.normcase which was a no-op, which was unhelpful
for cases like VFAT on Linux.
2011-11-15 14:25:11 -06:00
Matt Mackall
e576cf8a52 dirstate: don't fail when dropping a not-tracked file (issue3080)
Complex merges with divergent renames can cause a file to be 'moved'
twice, causing dirstate.drop() to be called twice. Rather than try to
ensure there are no unexpected corner cases where this can happen, we
simply ignore drops of files that aren't tracked.
2011-11-01 15:19:37 -05: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
Greg Ward
bc1dfb1ac9 atomictempfile: make close() consistent with other file-like objects.
The usual contract is that close() makes your writes permanent, so
atomictempfile's use of close() to *discard* writes (and rename() to
keep them) is rather unexpected. Thus, change it so close() makes
things permanent and add a new discard() method to throw them away.
discard() is only used internally, in __del__(), to ensure that writes
are discarded when an atomictempfile object goes out of scope.

I audited mercurial.*, hgext.*, and ~80 third-party extensions, and
found no one using the existing semantics of close() to discard
writes, so this should be safe.
2011-08-25 20:21:04 -04: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
b0bff1062c rename util.is_exec to isexec 2011-05-08 20:45:47 +02:00
Dan Villiom Podlaski Christiansen
511c941422 prevent transient leaks of file handle by using new helper functions
These leaks may occur in environments that don't employ a reference
counting GC, i.e. PyPy.

This implies:
 - changing opener(...).read() calls to opener.read(...)
 - changing opener(...).write() calls to opener.write(...)
 - changing open(...).read(...) to util.readfile(...)
 - changing open(...).write(...) to util.writefile(...)
2011-05-02 10:11:18 +02:00
Adrian Buehlmann
756a1d3529 move checkfilename from util to scmutil
checkfilename is specific to Mercurial, since it contains the knowledege
that Mercurial can't track files with \n or \r in the name.
2011-04-21 13:18:52 +02:00
Adrian Buehlmann
bd5adb64fa util: new function checkfilename
checkfilename checks for restrictions on filenames imposed by Mercurial
itself, irrespective of on what platform it is run.
2011-04-15 16:15:30 +02:00
Matt Mackall
191a7d2110 dirstate: add p1/p2 convenience methods 2011-04-04 15:52:55 -05:00
Adrian Buehlmann
8e573e829a dirstate: eliminate _lastnormal set
We can get rid of the _lastnormal set by using the filesystem mtimes to
identify the problematic "lastnormal" files on status(), forcing a file
content-comparison if the file's mtime timeslot is equal to _lastnormaltime.
2011-03-25 15:03:53 +01:00
Adrian Buehlmann
5af2f20339 dirstate: check mtime when adding to _lastnormal
- consistently use mtime as mapped to dirstate granularity (needed for
  filesystems like NTFS, which have sub-second resolution)
- no need to add files with mtime < _lastnormaltime
- improve comments
2011-03-24 18:39:54 +01:00
Adrian Buehlmann
1fc16b9686 dirstate: reset _lastnormal and _lastnormaltime
on write, invalidate, and clear
2011-03-23 11:22:29 +01:00
Matt Mackall
0473656f17 dirstate: flush _lastnormal when we see newer filesystem times 2011-03-23 09:34:22 -05:00
Matt Mackall
f8809566c2 merge with stable 2011-03-23 09:20:40 -05:00
Greg Ward
4bcecd8160 dirstate: avoid a race with multiple commits in the same process
(issue2264, issue2516)

The race happens when two commits in a row change the same file
without changing its size, *if* those two commits happen in the same
second in the same process while holding the same repo lock.  For
example:

  commit 1:
    M a
    M b
  commit 2:           # same process, same second, same repo lock
    M b               # modify b without changing its size
    M c

This first manifested in transplant, which is the most common way to
do multiple commits in the same process. But it can manifest in any
script or extension that does multiple commits under the same repo
lock. (Thus, the test script tests both transplant and a custom script.)

The problem was that dirstate.status() failed to notice the change to
b when localrepo is about to do the second commit, meaning that change
gets left in the working directory. In the context of transplant, that
means either a crash ("RuntimeError: nothing committed after
transplant") or a silently inaccurate transplant, depending on whether
any other files were modified by the second transplanted changeset.

The fix is to make status() work a little harder when we have
previously marked files as clean (state 'normal') in the same process.
Specifically, dirstate.normal() adds files to self._lastnormal, and
other state-changing methods remove them. Then dirstate.status() puts
any files in self._lastnormal into state 'lookup', which will make
localrepository.status() read file contents to see if it has really
changed.  So we pay a small performance penalty for the second (and
subsequent) commits in the same process, without affecting the common
case.  Anything that does lots of status updates and checks in the
same process could suffer a performance hit.

Incidentally, there is a simpler fix: call dirstate.normallookup() on
every file updated by commit() at the end of the commit.  The trouble
with that solution is that it imposes a performance penalty on the
common case: it means the next status-dependent hg command after every
"hg commit" will be a little bit slower.  The patch here is more
complex, but only affects performance for the uncommon case.
2011-03-20 17:41:09 -04:00
Matt Mackall
c6bc26dacb dirstate: introduce a public case normalizing method 2011-03-22 11:59:43 -05:00
Dan Villiom Podlaski Christiansen
ec590d5cd4 explicitly close files
Add missing calls to close() to many places where files are
opened. Relying on reference counting to catch them soon-ish is not
portable and fails in environments with a proper GC, such as PyPy.
2010-12-24 15:23:01 +01:00
Martin Geisler
6090144a5b merge with stable 2011-02-04 09:17:07 +01:00
trbs
2b860c833d subrepo: fix pruning of subrepo filenames in dirstate (issue2619) 2011-02-04 09:05:23 +01:00
Oleg Stepanov
501d7926e8 subrepo: do not report known files inside repositories as unknown 2011-01-04 03:53:11 -08:00
Martin Geisler
dc8a50e193 merge with stable 2011-01-05 15:56:03 +01:00
David Soria Parra
e107057815 avoid .split() in for loops and use tuples instead
split can be more readable for longer lists like the list in
dirstate.invalidate. As dirstate.invalidate is used in wlock() and therefoe
used heavily, I think it's worth avoiding a split there too.
2010-12-02 03:43:06 +01:00
Matt Mackall
341df0d469 dirstate: skip optimization on case-folding FS (issue2440) 2010-11-01 14:18:42 -05: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
Matt Mackall
3fe296798a dirstate: warn on invalid parents rather than aborting
This allows more graceful recovery from some mangled dirstates
2010-11-22 12:43:31 -06:00
Matt Mackall
51b3b09c8f backout most of 26e0b9a8ce0d 2010-09-24 12:46:54 -05:00
Brodie Rao
7362459729 cleanup: use x in (a, b) instead of x == a or x == b 2010-09-23 00:02:31 -05:00
Patrick Mezard
614db673f4 Merge with stable 2010-09-20 22:29:13 +02:00
Patrick Mezard
979ccf4590 Use lexists() instead of exists() where appropriate 2010-09-20 21:46:56 +02:00
Martin Geisler
974ce28a22 dirstate: use one pass to filter out files in subrepos 2010-09-10 23:53:51 +02:00
Martin Geisler
839c3422d1 cmdutil: use repo.auditor when constructing match object
This gives the repository control over which nested repository paths
that should be allowed via the custom path auditor.

Since paths into subrepositories are now allowed, dirstate.walk must
now filter away more paths than before.
2010-09-03 12:58:51 +02:00
Martin Geisler
797369393f dirstate: ignore symlinks when fs cannot handle them (issue1888)
When the filesystem cannot handle the executable bit, we currently
ignore it completely when looking for modified files. Similarly, it is
impossible to set or clear the bit when the filesystem ignores it.

This patch makes Mercurial treat symbolic links the same way.

Symlinks are a little different since they manifest themselves as
small files containing a filename (the symlink target). On Windows,
these files show up as regular files, and on Linux and Mac they show
up as real symlinks.

Issue1888 presents a case where the symlink files are better ignored
from the Windows side. A Linux client creates symlinks in a working
copy which is shared over a network between Linux and Windows clients.

The Samba server is helpful and defererences the symlink when the
Windows client looks at it. This means that Mercurial on the Windows
side sees file content instead of a file name in the symlink, and
hence flags the link as modified. Ignoring the change would be much
more helpful, similarly to how Mercurial does not report any changes
when executable bits are ignored in a checkout on Windows.

An initial checkout of a symbolic link on a file system that cannot
handle symbolic links will still result in a regular file containing
the target file name as its content. Sharing such a checkout with a
Linux client will not turn the file into a symlink automatically, but
'hg revert' can fix that. After the revert, the Windows client will
see the correct file content (provided by the Samba server when it
follows the link on the Linux side) and otherwise ignore the change.

Running 'hg perfstatus' 10 times gives these results:

  Before:          After:
  min: 0.544703    min: 0.546549
  med: 0.547592    med: 0.548881
  avg: 0.549146    avg: 0.548549
  max: 0.564112    max: 0.551504

The median time is increased about 0.24%.
2010-08-09 15:31:56 +02:00
Benoit Boissinot
33390381d7 dirstate: more explicit name, rename normaldirty() to otherparent() 2010-04-20 11:17:01 +02:00
Benoit Boissinot
f54fbfa907 dirstate: remove unused variable 2010-04-16 19:18:20 +02:00
Benoit Boissinot
498261f658 dirstate: no need to iterate twice, a dict can be updated in place 2010-04-06 11:49:42 +02:00
Benoit Boissinot
c3e1bfcf81 dirstate: fix in memory dirstate entries for 1-second race
Only the on-disk file was modified, we need to modify the in-memory dirstate
as well.
2010-04-05 18:13:20 +02:00
Matt Mackall
dd8f91e931 Merge with stable 2010-02-11 17:44:01 -06:00
Wagner Bruna
a4d5546600 branch: avoid using reserved tag names
Reported as Debian bug #552423.
2010-02-11 12:02:48 -02:00
Benoit Boissinot
328394047f fix coding style (reported by pylint) 2010-02-08 15:36:34 +01:00
Matt Mackall
595d66f424 Update license to GPLv2+ 2010-01-19 22:20:08 -06:00
Benoit Boissinot
f7540399b7 remove unused imports 2009-10-31 16:56:58 +01:00
Alexander Solovyov
32999e4659 make path expanding more consistent
This expands ~user and $FOO constructs in ui.ignore files, [defaults],
[paths], extension paths, and HGRCPATH files.
2009-10-19 22:19:28 +03:00
Greg Ward
0957bc4d5c dirstate: add/improve method docstrings.
- add doc to __init__(), _map(), status()
- enhance for __getitem__()
- fix inaccurate doc for walk() (described wrong return type)
2009-10-01 15:36:45 -04:00
Adrian Buehlmann
03085a4ef2 dirstate: kill dirstate.granularity config option
The dirstate.granularity configuration parameter was never documented,
it only adds code complexity and it is unneeded.

Adding comments describing forced 'unset' entries.
2009-10-01 17:17:52 +02:00
Adrian Buehlmann
0a39b63526 dirstate.write: don't ignore stat data if mtime is in the future (issue1790)
This change narrows the race guard that was introduced by ffd022830d6d
("dirstate: ignore stat data for files that were updated too recently")
to not discard the _map entry's stat data if the mtime is in the future.

Without this change, status locks files having odd mtimes in the future
into the 'unset' state, causing needless file compares later (admittedly
harmless), but also inflicting highly irritating sticky effects on
tools/plugins that directly read .hg/dirstate (e.g. TortoiseHg).
2009-08-21 14:17:23 +02:00
Patrick Mezard
6d36e612e9 dirstate: fix typo introduced by ceed02d64e3b 2009-06-13 22:42:16 +02:00
Matt Mackall
edecde7d3c dirstate: eliminate reference cycle from normalize
Bound methods hold a reference to self, so assigning a bound method to
an instance unavoidably creates a cycle. Work around this by choosing
a normalize method at walk time instead. Eliminate default arg while
we're at it.
2009-06-08 18:14:44 -05:00
Matt Mackall
7c6f521b8f dirstate: don't complain about 0-length files 2009-06-04 16:21:09 -05:00
Matt Mackall
11d4ab2e09 dirstate: more accurate use of match.dir callback 2009-06-01 20:25:01 -05:00
Matt Mackall
ac02180873 match: fold plan cases down to two special cases
- merge always and match with patterns
- make always and match with patterns the default
- invert dostep3 to skipstep3
- move dirignore test inside exact case
2009-05-31 17:54:18 -05:00
Matt Mackall
fdab704ebc walk: refactor walk plan
- never is gone
- reorder tests more cleanly
- rename nomatches to exact for clearer semantics
2009-05-31 17:54:18 -05:00
Matt Mackall
9c7c16f5cf walk: use match.bad callback for filetype messages 2009-05-31 17:54:18 -05:00
Matt Mackall
37eaadf540 match: ignore return of match.bad
All users returned false, return can now be dropped
2009-05-31 17:54:18 -05:00
Matt Mackall
7c83618e4d walk: simplify logic for badfn clause
- matchfn redundant
- call badfn always rather than fwarn
- use for/else rather than keep var
2009-05-31 17:54:18 -05:00
Matt Mackall
2e3801b37e walk: we always have a badfn 2009-05-31 17:54:18 -05:00
Matt Mackall
6275c6f6e2 walk: simplify check for missing file 2009-05-31 17:54:18 -05:00
Martin Geisler
09d5799bbb dirstate: fixed typo in comment 2009-05-27 23:39:41 +02:00
Matt Mackall
66cde5c7cb dirstate: notice truncated parents read 2009-05-25 12:48:15 -05:00
Simon Heimberg
4b2cc385e8 dirstate: skip step 3 in walk if nothing new will match
nothing will ever match on match.never
nothing new will match on match.exact (all found in step 1)
nothing new will match on match.match when
  there is no pattern and
  there is no direcory in pats
2009-05-14 19:54:26 +02:00
Simon Heimberg
3a8453f88a dirstate: set more states in step 1 of walk 2009-05-14 10:50:45 +02:00
Simon Heimberg
23a0184faf dirstate: use quicker matchfn() instead of match() everywhere
matchfn does the same as match(), but a direct "link"
2009-05-14 19:47:52 +02:00
Simon Heimberg
09ac1e6c92 separate import lines from mercurial and general python modules 2009-04-28 17:40:46 +02:00
Simon Heimberg
054906a1f5 dirstate: translate forgotten string 2009-05-08 07:54:00 +02:00
Matt Mackall
2beed3c7cc dirstate: use propertycache 2009-04-29 20:47:18 -05:00
Martin Geisler
8e4bc1e9ad put license and copyright info into comment blocks 2009-04-26 01:13:08 +02:00
Martin Geisler
750183bdad updated license to be explicit about GPL version 2 2009-04-26 01:08:54 +02:00
Matt Mackall
2f9b02c62d replace util.sort with sorted built-in
This is marginally faster for small and moderately-sized lists
2009-04-26 16:50:44 -05:00
Martin Geisler
44aa7e92d1 util: use built-in set instead of util.unique 2009-04-22 00:56:06 +02:00
Patrick Mezard
c8f0bb9bb7 mq: drop copy records when refreshing regular patches (issue1441)
Copy information was saved in a common loop, then refined in a git-only block.
The problem was the latter did filter out renames occuring in the current
patch and irrelevant to commit. In the non-git case, copy records still existed
in the dirstate, referencing removed files, making the commit to fail. Git and
non-git copy handling paths are now separated for simplicity.

Reported by Gary Bernhardt
2009-01-04 21:32:40 +01:00
Matt Mackall
8d99be19f0 many, many trivial check-code fixups 2010-01-25 00:05:27 -06:00
Matt Mackall
cd3ef170f7 Merge with stable 2010-01-19 22:45:09 -06:00
Augie Fackler
678623416a dirstate: don't check state of subrepo directories 2009-12-31 17:19:30 -06:00
Martin Geisler
d994e41c61 dirstate: improve docstring formatting
Triple-quoted strings are easier to spot than single-quoted strings.
2009-12-27 23:24:05 +01:00
Benoit Boissinot
ea7fe6dacc remove unused variables 2008-10-28 19:25:26 +01:00
Dirkjan Ochtman
371218cc63 get rid of semi-colon introduced in 89c0afc2016a 2008-10-18 16:30:50 +02:00
Matt Mackall
4eb3a715b4 dirstate: always add times to map as integers
Fix bug spotted by Dov Feldstern
2008-10-18 04:26:06 -05:00
Petr Kodl
681e2c1a41 Take advantage of fstat calls clustering per directory if OS support it.
util module implements two versions of statfiles function

_statfiles calls lstat per file

_statfiles_clustered takes advantage of optimizations in osutil.c, stats all
files in directory at once when new directory is hit and caches the results

util.statfiles dispatches to appropriate version during module loading

The speedup on directory tree with 2k directories and 63k files is about
factor of 1.8 (1.3s -> 0.8s for hg diff - hg startup overhead about .2s)

At this point only Win32 now benefit from this patch.
Rest of OSes use the non clustered implementation.
2008-10-09 10:29:47 -04:00
Benoit Boissinot
1d33f1c63b dirstate.walk: skip unreadable directories (issue1213)
Do not abort on permission denied error, just skip the directory.
2008-10-15 14:52:27 +02:00
Benoit Boissinot
45680829ac dirstate._dirs: fix refcounting broken by ece124266b74
reported by Patrick Waugh
2008-10-15 01:14:29 +02:00
Matt Mackall
1c5fcf7d0e dirstate: C parsing extension 2008-10-12 15:21:08 -05:00
Petr Kodl
f41fa5275a Eliminate normpath from foldmap calls.
Normcase already takes care of upper/lower case and /->\ conversions.

What's left for normpath is folding of a/../a sequences but this should
be either done consistently on both non-folding and folding code path
or not at all, otherwise we are introducing inconsistent behavior between the
two that has nothing to do with case folding.

Second argument against it - normpath being pure Python function is very slow -
as much as 50% of time is spend just inside normpath call on my repository.
2008-09-30 17:23:08 -04:00
Petr Kodl
6dacfe6beb issue 1286: dirstat regression on case folding systems
This patch fixes regression reported in 1286 that causes util.fspath
to be called for every file not in current manifest - including ignored files.
The regression is quite severe - the time for simple hg st goes from 5s to 1m38s
on one of my source trees - which basically renders mercurial useless.
2008-09-30 17:23:08 -04:00
Matt Mackall
2d47031d0d listdir: add support for aborting if a certain path is found
This lets us bail out early if we find '.hg', letting us skip sorting
and bisecting for it.
2008-09-13 10:46:47 -05:00
Matt Mackall
7ce9a41a12 dirstate: improve performance for building _dirs 2008-09-12 19:57:07 -05:00
Benoit Boissinot
cdffbdce00 dirstate: use the right variable (f, not ff) 2008-09-10 22:54:28 +02:00
Peter Ruibal
30a2036f9e use Exception(args)-style raising consistently (py3k compatibility) 2008-09-08 13:07:00 +02:00
Benoit Boissinot
7f2ac71a6c make normalize() work when cwd != repo.root 2008-09-02 22:04:09 +02:00
Andrei Vermel
4812226d8b Fix normalize fail on non-lowercase filename (Issue1273)
regression introduced in 367ff9c9d221
2008-08-02 19:34:50 +04:00
Benoit Boissinot
882dcf0454 dirstate: explain why appending instead of os.path.join() is safe 2008-09-02 17:32:07 +02:00
Benoit Boissinot
fe44f90406 performance: normalize self._root, avoid calling os.path.join() in dirstate
In dirstate, self._join() might get called a lot. Instead of calling it
we create self._rootdir and we then only need to append the filename.
2008-09-02 15:12:50 +02:00
Benoit Boissinot
a835798d04 performance: do not stat() things when not required
Ignore unknown files if we don't need them (eg in hg diff).
It slows things down a little bit for big trees (kernel repo), since _join()
is called for each file instead of for each directory.

fix issue567
2008-09-02 15:08:26 +02:00
Matt Mackall
ec9023fc53 dirstate.walk: speed up calling match function 2008-07-22 13:03:31 -05:00
Matt Mackall
bc3382c896 dirstate.walk: reduce sorting in step 3 2008-07-22 13:03:29 -05:00
Matt Mackall
4979b90382 dirstate.walk: inline imatch
This lets us carefully avoid calling ignore and match where possible
in the fast path.
2008-07-22 13:03:25 -05:00
Matt Mackall
16c391fd58 dirstate.walk: more cleanups
- group internal functions
- simplify imatch
- rename _join to join
- use nf in step 3
- use .hg in results
2008-07-22 13:03:24 -05:00
Matt Mackall
8e4bbebebc dirstate.walk: fold in _supported
- inline tests for regular or link files
- simplify bad type reporting
2008-07-22 13:03:23 -05:00
Matt Mackall
e008b3db94 dirstate.walk: build a dict rather than yield
Since we're already building a seen dict, we might as well put our
results in it to go slightly faster.
2008-07-22 13:03:21 -05:00
Matt Mackall
4dbb566744 dirstate.walk: minor cleanups
- add dirkind
- simplify loop structure
- avoid pconvert and join on directory entries (big speed bump)
- remove redundant seen set in step 3
2008-07-22 13:03:20 -05:00
Matt Mackall
8cb2b4a288 dirstate.walk: push sorting up 2008-07-22 13:03:19 -05:00
Matt Mackall
c92a459e5d dirstate.walk: pull directory scanning into top-level loop 2008-07-22 13:03:18 -05:00
Matt Mackall
3f15476596 dirstate.walk: unify match.dir logic 2008-07-22 13:03:17 -05:00
Matt Mackall
6149899c06 dirstate.walk: simplify .hg scan bisect logic 2008-07-22 13:03:16 -05:00
Matt Mackall
22a6fcf0d1 dirstate.walk: track normalized directory names 2008-07-22 13:03:15 -05:00
Matt Mackall
6f3a239e30 dirstate: simplify normalize logic 2008-07-22 13:03:14 -05:00
Matt Mackall
dab7588539 dirstate.walk: change names for dc and known
known -> seen
dc -> dmap
2008-07-22 13:03:13 -05:00
Matt Mackall
6b6e7d5723 dirstate.walk: fold findfiles into main walk loop 2008-07-22 13:03:10 -05:00
Matt Mackall
7bc24c8723 dirstate.walk: eliminate filter function
- remove _filter and delete original
- improve some filtering logic
2008-07-22 13:03:08 -05:00
Matt Mackall
9d3da8e0ee dirstate.walk: eliminate src from yield
- restructure 'step two' to stat unseen files
- remove extra stat logic in status
- remove redundant src
2008-07-22 13:02:36 -05:00
Patrick Mezard
90eabcbff1 dirstate: remove superfluous normalize() call in walk() 2008-07-20 19:25:08 +02:00
Patrick Mezard
37536c33c2 dirstate: fix _droppath() typo from be348d0dd417 2008-07-20 19:08:59 +02:00
Matt Mackall
21163fdc2f dirstate: simplify/optimize path checking
- add fast _finddirs function
- remove recursion from incpath/decpath
- split changepath into addpath/droppath
- change relax arg to check
- move incpathcheck logic into addpath
- move incpath into addpath
- move decpath into droppath
- inline code in self._dirs creation
2008-07-11 18:46:02 -05:00
Matt Mackall
a65ef7bc5d util: add sort helper 2008-06-27 18:28:45 -05:00
Matt Mackall
9ae3592d4e dirstate: improve case-folding logic
- return normalized form in directory walk
- track normalized form in known
2008-06-26 15:55:23 -05:00
Matt Mackall
4382d6c797 dirstate: fold statwalk and walk 2008-06-26 14:35:50 -05:00
Matt Mackall
73c76dd164 repo.status: eliminate list_ 2008-06-26 14:35:50 -05:00
Matt Mackall
bc715be859 add __len__ and __iter__ methods to repo and revlog 2008-06-26 14:35:50 -05:00
Matt Mackall
dcacfb3161 manifest: remove execf/linkf methods 2008-06-26 14:35:50 -05:00
Matt Mackall
b2155285a8 rename checkfolding to checkcase 2008-06-26 13:58:24 -05:00
Matt Mackall
be55fba8f6 dirstate: remove unused folding function 2008-06-26 13:58:22 -05:00
Matt Mackall
d462e1fc26 simplify flag handling
add _checklink var to dirstate
introduce dirstate.flagfunc
switch users of util.execfunc/linkfunc to flagfunc
change manifestdict.set to take a flags string
change ctx.fileflags to ctx.flags
change gitmode func to a dict
remove util.execfunc/linkfunc
2008-06-26 13:46:34 -05:00
Patrick Mezard
1fa87a95fd Merge with crew-stable 2008-06-15 13:05:39 +02:00
Patrick Mezard
c7f6f81b90 Ignore dummy copies in dirstate and localrepo.filecommit() 2008-06-15 13:01:03 +02:00
Paul Moore
8eff9bc01c Add a normalize() method to dirstate
This method returns the normalised form of a path. This is
  - the form in the dirstate, if available, or
  - the form on disk, if available, or
  - the form passed on the command line
normalize() is called on the type-'f' result of statwalk.

This fixes issues 910 and 1092
2008-06-06 19:23:29 +01:00
Paul Moore
b8887e9f02 Add a folding() method to dirstate
The method returns True if the dirstate is on a case folding filesystem.
2008-06-06 08:29:16 +01:00
Matt Mackall
fb88571d19 match: remove files arg from repo.status and friends 2008-05-12 11:37:08 -05:00
Matt Mackall
dda89645c0 dirstate: remove default from status list_unknown 2008-05-12 11:37:08 -05:00
Matt Mackall
48d9afe7e5 dirstate: minor status cleanups 2008-05-12 11:37:08 -05:00
Matt Mackall
dbcb631016 status: rename type_ to state 2008-05-12 11:37:08 -05:00
Matt Mackall
71a4886284 walk: use match.bad in statwalk 2008-05-12 11:37:08 -05:00
Matt Mackall
b4d6b6c45b walk: use match.dir in statwalk 2008-05-12 11:37:08 -05:00
Matt Mackall
7e413542cf walk: make dirstate.walk return a single value too 2008-05-12 11:37:08 -05:00
Matt Mackall
525eaf2be0 walk: remove more old badmatch logic 2008-05-12 11:37:08 -05:00
Matt Mackall
1897262320 walk: begin refactoring badmatch handling 2008-05-12 11:37:07 -05:00
Matt Mackall
15d8da57c1 walk: remove files arg from repo.walk and dirstate.walk 2008-05-12 11:37:07 -05:00
Matt Mackall
7f74aac054 walk: eliminate some default variables 2008-05-12 11:37:07 -05:00