Commit Graph

373 Commits

Author SHA1 Message Date
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
Patrick Mezard
f572ee0b5f dirstate: do not ignore current directory '.' (issue 1078) 2008-04-05 18:15:04 +02:00
Matt Mackall
c517f4bb58 dirstate: refactor granularity code, add a test
- rename option dirstate.granularity
- move option reading into .write()
- add a simple test
2008-03-20 13:53:59 -05:00
Alexis S. L. Carvalho
d40b29d203 dirstate: ignore stat data for files that were updated too recently
This should fix the race where

  hg commit foo
  <change foo without changing its size>

happens in the same second and status is fooled into thinking foo
is clean.

A configuration item is used to determine the timeout, since different
filesystems may have different requirements (I think VFAT needs 3s,
while most Unix filesystems are fine with 1s).
2008-03-19 17:55:21 -03:00
Alexis S. L. Carvalho
dc7b734ee2 normallookup: during merges, restore the state saved by remove 2008-03-18 04:07:39 -03:00
Alexis S. L. Carvalho
cfe6940b56 dirstate.remove: during merges, remember the previous file state
We encode the previous state as a negative file size (AFAICS, previous
versions of hg always have size == 0 when state == 'r').

We save the state of 'm'erged and dirty files, because they're the
two states that indicate that a file has to be committed on a merge
to correctly record per-file history.
2008-03-18 04:07:39 -03:00
Alexis S. L. Carvalho
7a9e64075f dirstate: ignore mode changes if the fs does not supports the exec bit
This can make a difference when e.g. the repo is exported through NFS
(which support exec bits) and CIFS (which does not).
2008-03-14 09:56:58 -03:00
Joel Rosdahl
4f8012378a Remove unused imports 2008-03-06 22:23:41 +01:00
Joel Rosdahl
5dae3059a0 Expand import * to allow Pyflakes to find problems 2008-03-06 22:23:26 +01:00
Thomas Arendsen Hein
d659d68d7a Extend/correct f488b5acd598 regarding -qA and ignored files.
hg status -qA will now hide untracked files as described in the doc string.
2008-03-02 13:52:34 +01:00
Thomas Arendsen Hein
d7cabb1e8d Report filenames with disallowed characters as suggested by Mika Eloranta
(see issue671)
2008-02-17 12:53:57 +01:00
Alexis S. L. Carvalho
85673c1586 status: put added files that have disappeared in the deleted list
This gives the user an indication that something went wrong with this file:

$ hg add foo
$ rm foo
$ hg status foo
! foo

Fixes issue212.
2008-02-14 18:08:16 -02:00
Thomas Arendsen Hein
d8e42b5304 Remove trailing ! from two error messages as this was confusing. 2008-02-09 19:13:57 +01:00
Alexis S. L. Carvalho
8b9b7ae9bd Merge with crew-stable 2008-02-08 18:31:55 -02:00
Alexis S. L. Carvalho
c32e3d63c7 dirstate.status: avoid putting ignored files in the unknown list
If list_ignored was false, we would blindly add files not in the
dirstate to the unknown list.

This should finish fixing issue886.
2008-02-08 18:07:55 -02:00
Alexis S. L. Carvalho
72ccf087ac dirstate: don't walk ignored directories
With a pattern like '^directory$' in .hgignore, a "hg status directory"
would still walk "directory" and all its subdirs.

This is the first half of a fix for issue886.
2008-02-08 18:07:55 -02:00
Christian Ebert
5c18a69d2e Prefer i in d over d.has_key(i) 2008-01-20 14:39:25 +01:00
Shun-ichi GOTO
188e44cf4b Add endswithsep() and use it instead of using os.sep and os.altsep directly.
This change is intended to allow hooking endswithsep() by win32mbcs
extension for MBCS support.
2008-01-09 21:30:35 +09:00
Shun-ichi GOTO
478c0b9176 Use util.normpath() instead of direct path string operation.
This change is intended to allow hooking normpath() by win32mbcs
extension for MBCS support.
2008-01-09 21:30:13 +09:00
Maxim Dounin
084e15f969 Fix dir-changed-to-file updates on clean workdir.
Workaround for dir-changed-to-file updates mentioned
in rev c3f3393b9096 doesn't actually work since tests
introduced in mentioned changeset prevented dirstate
updates even if working directory updates succeded.

Make tests more relaxed for dirstate operations
not directly accessible from cli. See also issue660.

While here, move _dirs existance check from _decpath()
to _changepath() for unification.
2007-11-07 22:57:28 +01:00
Maxim Dounin
8561d688a1 Fix file-changed-to-dir and dir-to-file commits (issue660).
Allow adding to dirstate files that clash with previously existing
but marked for removal. Protect from reintroducing clashes by revert.

This change doesn't address related issues with update. Current
workaround is to do "clean" update by manually removing conflicting
files/dirs from working directory.
2007-11-05 20:05:44 +03:00
Bryan O'Sullivan
e317f81ab3 Add osutil module, containing a listdir function.
This is similar to os.listdir, only it returns a sorted list of tuples.
2007-10-05 15:01:06 -07:00
Matt Mackall
b7b5c1ade9 dirstate: speed up read and write
read:
- single call to len(st)
- fewer assignments for position tracking
- don't split apart tuple from unpack
- use a literal for the unpack spec

write:
- localize variables and functions
- avoid copied function call
- use % for string concatenation
2007-09-24 12:41:54 -05:00
Matt Mackall
c79b6cded5 dirstate: make dir collision logic faster
- shortcircuit decpath if we haven't built the _dirs map
- increment only for leafnodes of directory tree
  (this should make construction more like O(nlog n) than O(n^2))
2007-09-24 12:36:38 -05:00
Alexis S. L. Carvalho
a345c2c9da merge: forcefully mark files that we get from the second parent as dirty
After a hg merge, we want to include in the commit all the files that we
got from the second parent, so that we have the correct file-level
history.  To make them visible to hg commit, we try to mark them as dirty.

Unfortunately, right now we can't really mark them as dirty[1] - the
best we can do is to mark them as needing a full comparison of their
contents, but they will still be considered clean if they happen to be
identical to the version in the first parent.

This changeset extends the dirstate format in a compatible way, so that
we can mark a file as dirty:

Right now we use a negative file size to indicate we don't have valid
stat data for this entry.  In practice, this size is always -1.

This patch uses -2 to indicate that the entry is dirty.  Older versions
of hg won't choke on this dirstate, but they may happily mark the file
as clean after a full comparison, destroying all of our hard work.

The patch adds a dirstate.normallookup method with the semantics of the
current normaldirty, and changes normaldirty to forcefully mark the
entry as dirty.

This should fix issue522.

[1] - well, we could put them in state 'm', but that state has a
different meaning.
2007-08-23 01:48:29 -03:00
Alexis S. L. Carvalho
9107d93d2f merge with crew-stable 2007-08-06 01:00:10 -03:00
Alexis S. L. Carvalho
502ca449fe dirstate: fix rebuild; add a test
If rebuild calls invalidate, it will just queue a (re)read of the dirstate
file, while what we really want is to empty the current state.
2007-08-05 23:04:56 -03:00
Bryan O'Sullivan
a487c999a8 dirstate: improve error message on file/directory clash 2007-08-01 12:03:10 -07:00
Matt Mackall
fc2b62f41f dirstate: localize a bunch of methods in status fastpath 2007-07-26 12:02:58 -05:00
Matt Mackall
c16b9a14c4 dirstate: speed up sorting in findfiles 2007-07-26 12:02:58 -05:00
Matt Mackall
24095cdf2c revlog: pass mode to _supported directly 2007-07-26 12:02:58 -05:00
Matt Mackall
8e7fb240b4 dirstate: localize a bunch of methods for findfiles 2007-07-26 12:02:58 -05:00
Matt Mackall
cd72dc7f1b Merge with crew 2007-07-21 16:44:38 -05:00
Matt Mackall
450dc6247d dirstate: add doesn't need to call stat 2007-07-21 16:02:09 -05:00
Matt Mackall
81e9f172fb dirstate: get rid of default args for status 2007-07-21 16:02:09 -05:00
Matt Mackall
43547721ea dirstate: make filterfiles private 2007-07-21 16:02:09 -05:00
Matt Mackall
c2967290a5 dirstate: add __contains__ and make __getitem__ more useful
dirstate.state(f) == '?' -> f not in dirstate
dirstate.state(f) -> dirstate[f]
2007-07-21 16:02:09 -05:00
Matt Mackall
bab511ec55 dirstate: make wjoin function private 2007-07-21 16:02:09 -05:00
Matt Mackall
cf691df912 dirstate: break update into separate functions 2007-07-21 16:02:09 -05:00
Matt Mackall
1a40b796d1 dirstate: use True and false for _dirty 2007-07-21 16:02:09 -05:00
Alexis S. L. Carvalho
afb05aff16 dirstate.invalidate: avoid rebuilding _map
Since hasattr will call __getattr__, the call to hasattr(self, '_dirs')
will end up reparsing the dirstate file.
2007-07-19 19:43:25 -03:00
Alexis S. L. Carvalho
534a817230 add dirstate._dirtypl variable
Theoretically, it's possible to forget modified dirstate
parents by doing:

dirstate.invalidate()
dirstate.setparents(p1, p2)
dirstate._map

The final access to _map should call _read(), which will
unconditionally overwrite dirstate._pl.

This doesn't actually happen right now because invalidate
accidentally ends up rebuilding dirstate._map.
2007-07-19 19:43:25 -03:00
Alexis S. L. Carvalho
64a37442ed dirstate.status: if a file is marked as copied, consider it modified
After a "hg copy --force --after somefile cleanfile", cleanfile
shouldn't be considered clean anymore.
2007-06-21 23:42:06 -03:00
Alexis S. L. Carvalho
d4cae7d8a5 dirstate.invalidate: clear dirty flag 2007-06-21 00:34:14 -03:00
Alexis S. L. Carvalho
3beeb3356f dirstate: fix typo 2007-06-21 00:34:14 -03:00
Thomas Arendsen Hein
4d29c6dc8e Updated copyright notices and add "and others" to "hg version" 2007-06-19 08:51:34 +02:00
Thomas Arendsen Hein
483231d996 Cleanup of whitespace, indentation and line continuation. 2007-06-19 08:06:37 +02:00
Matt Mackall
b99ae11550 dirstate: pull ignore smarts out of ui 2007-06-18 13:24:34 -05:00
Matt Mackall
2033c5f43d dirstate: refactor checkinterfering 2007-06-18 13:24:34 -05:00
Matt Mackall
be01255569 dirstate: hide some more internals 2007-06-18 13:24:34 -05:00
Matt Mackall
c71a2b10a7 dirstate: hide internal vars
Add an __iter__ method so commands don't need to poke at _map.
2007-06-18 13:24:34 -05:00
Matt Mackall
e957b05434 localrepo and dirstate: rename reload to invalidate
We want to avoid actually reloading if possible.
2007-06-18 13:24:34 -05:00
Matt Mackall
5b067f098a dirstate: simplify dirty handling 2007-06-18 13:24:34 -05:00
Matt Mackall
dd962fae26 dirstate: lazify and lambdafy _slash 2007-06-18 13:24:34 -05:00
Matt Mackall
12c1ce4938 dirstate: simplify state() 2007-06-18 13:24:34 -05:00
Matt Mackall
38474db3cb dirstate: move ignore to its own file 2007-06-18 13:24:34 -05:00
Matt Mackall
c0a4aebd3c dirstate: replace clear() 2007-06-18 13:24:34 -05:00
Matt Mackall
90c0194d9b dirstate: fold parse into read 2007-06-18 13:24:33 -05:00
Matt Mackall
dd38b9f308 dirstate: make reload lazy 2007-06-18 13:24:33 -05:00
Matt Mackall
6a2d255741 dirstate: lazify initdirs 2007-06-18 13:24:33 -05:00
Matt Mackall
bb39ad22fb dirstate: lazify copymap, _branch, and _pl 2007-06-18 13:24:33 -05:00
Matt Mackall
3da450bd87 dirstate: use getattr rather than lazyread 2007-06-18 13:24:33 -05:00
Alexis S. L. Carvalho
af3964b248 Add ui.slash hgrc setting
This will make most commands print paths using "/", regardless of
the value of os.sep.
2007-06-08 23:49:12 -03:00
Alexis S. L. Carvalho
e1bf8e80c5 Add dirstate.pathto and localrepo.pathto.
Every time util.pathto is called, we have to pass the repo root and the
repo cwd.

dirstate.pathto is a simple convenience function that knows about the
root and the cwd arguments.  It's still possible to pass the cwd as an
optimization.

localrepo.pathto is a convenience function that just calls
dirstate.pathto, just like localrepo.getcwd.

dirstate.pathto becomes a single point that converts most (all?) paths
from the internal representation to some OS-specific relative path for
display purposes.
2007-06-08 23:49:12 -03:00
Alexis S. L. Carvalho
b53e571f31 Use atomictemp files to write the dirstate.
atomic files are not safe in all cases.
2007-06-05 19:55:27 -03:00
Patrick Mezard
0bf2bda86a Merge with crew-stable. 2007-05-19 22:51:43 +02:00
Patrick Mezard
6db235d2bb Fix issue 562: .hgignore requires newline at end.
End-of-lines characters where discarded without any check for existence.
2007-05-19 22:47:01 +02:00
Bryan O'Sullivan
06ea864877 When reloading the dirstate, recompute ignore information if needed. 2007-04-24 12:02:51 -07:00
Bryan O'Sullivan
3b15a417aa dirstate: speed up write by 50%. 2007-04-24 12:02:42 -07:00
Bryan O'Sullivan
6518558080 dirstate: make parents() faster.
This allows localrepository.status() to avoid reading all but the
first 40 bytes of the dirstate in the common case of running "hg
status".
2007-04-24 11:46:15 -07:00
Matt Mackall
e293a4cd6d Merge with stable 2007-04-10 14:05:15 -05:00
Alexis S. L. Carvalho
9497591b05 use atomictemp files to write the dirstate 2007-04-09 04:24:17 -03:00
Alexis S. L. Carvalho
ec44599dd1 Merge additional fixes for my matcher changes 2007-03-20 22:21:05 -03:00
Alexis S. L. Carvalho
6f408bf4cd Pass normalized directory names to the ignore function
This fixes a bad performance regression caused by b959487f328c.
2007-03-20 22:09:53 -03:00
Alexis S. L. Carvalho
47cb22b5a2 Merge with crew-stable 2007-03-16 00:45:18 -03:00
Alexis S. L. Carvalho
e488c0e84f Fix handling of paths when run outside the repo.
The main problem was that dirstate.getcwd() returned just "",
which was interpreted as "we're at the repo root".  It now returns
an absolute path.

The util.pathto function was also changed to deal with the "cwd is
an absolute path" case.
2007-03-16 00:22:58 -03:00
Alexis S. L. Carvalho
fcb39243b1 pass repo.root to util.pathto() in preparation for the next patch 2007-03-16 00:22:57 -03:00
Matt Mackall
e896adead6 Merge with -stable, fix small test failure 2007-03-14 01:26:09 -05:00
Matt Mackall
c2bb73121f Move branch read/write to dirstate where it belongs 2007-03-13 18:50:02 -05:00
Alexis S. L. Carvalho
641d95a966 Merge a bunch of matcher and locate fixes. 2007-03-10 23:21:33 -03:00
Alexis S. L. Carvalho
393022dbbb dirstate.statwalk: explicitly test for ignored directories
This removes a hack where we appended '/' to a dirname so that:
- it would not appear on the "dc" dict
- it would always be matched by the match function

This was a contorted way of checking if the directory was matched by
some hgignore pattern, and it would still fail with some uses of
--include/--exclude patterns.

Things would still work fine if we removed the check altogether and
just appended things to "work" directly, but then we would end up
walking ignored directories too, which could be quite a bit of work.

This allows further simplification of the match function returned by
util._matcher, and fixes walking the working directory with a
--include pattern that matches only the end of a name.
2007-03-10 23:00:54 -03:00
Brendan Cully
5641becd5a Merge with crew-stable 2007-03-10 17:45:32 -08:00
Alexis S. L. Carvalho
0458b30ebf statwalk: don't put self.root in the files list
That list is supposed to contain internal, normalized names ("/"-separated,
relative to the repo root), not OS-native paths.
2007-03-10 22:03:22 -03:00
Emanuele Aina
de446cd10b Yield directories in dirstate.statwalk() 2007-03-06 17:45:39 -03:00
Andrei Vermel
d789a5b4fc Fix dirstate fail at drive root on Windows 2007-02-09 20:50:41 +03:00
Alexis S. L. Carvalho
744364abd4 merge with crew-stable 2007-02-13 10:25:45 -02:00
Matt Mackall
770d679638 symlinks: don't complain about symlinks 2006-12-29 20:04:31 -06:00
Matt Mackall
296d6a7cb8 Simplify i18n imports 2006-12-14 20:25:19 -06:00
Matt Mackall
f17a4e1934 Replace demandload with new demandimport 2006-12-13 13:27:09 -06:00
Benoit Boissinot
89233a98c7 remove unnecessary call to umask 2006-12-09 18:49:24 +01:00
Thomas Arendsen Hein
3982b314a6 issue228: Fix repositories at the filesystem root (/ or C:\)
Thanks to Robert Shaw and other people on the list for the suggestions.
2006-11-09 21:53:45 +01:00
Benoit Boissinot
7d00e37112 issue352: disallow '\n' and '\r' in filenames (dirstate and manifest) 2006-11-01 17:56:55 +01:00
Matt Mackall
64f1cb83ae small refactoring of path normalization in dirstate.statwalk 2006-10-27 14:10:01 -05:00
Matt Mackall
7f3045c670 Simplify ignore logic in dirstate.walk
- kill blockignore hack
- pull pconvert out of imatch
- skip imatch when not ignoring
2006-10-27 12:09:33 -05:00
Matt Mackall
5186d07f32 improve walk docstrings 2006-10-27 11:24:10 -05:00
Matt Mackall
f84252f879 simplify dirstate walking
- kill walkhelper
- stop passing dc around
- remove unused stat arg from statmatch (renamed imatch)
2006-10-26 23:54:24 -05:00
Thomas Arendsen Hein
0a7b982aa6 Whitespace/Tab cleanup 2006-10-01 19:26:33 +02:00
Matt Mackall
cf29118af5 dirstate: add copies function
rename copies to copymap
2006-09-25 17:53:17 -05:00
Alexis S. L. Carvalho
d7eab34ed8 dirstate.py: when comparing mtimes, use only the integer part.
Python 2.5 can return timestamps with subsecond resolution.
2006-08-20 01:13:11 -03:00
Vadim Gelfer
853998bf60 fix issue 322.
do not allow to add files that shadow files or directories already in dirstate.
2006-08-18 21:03:29 -07:00
Vadim Gelfer
dc377b58c1 update copyrights. 2006-08-12 12:30:02 -07:00
Matt Mackall
7c0506a4f5 Merge manifest refactor work 2006-08-09 15:03:46 -05:00
Benoit Boissinot
e8d38e08fe self.root == '/': prefix length computation out of the loop
- put the computation out of the loop
- change the variable to a more meaningful name
2006-07-25 21:22:56 +02:00
Gil
82203eb025 Fix dirstate.walkhelper removing first char of nd when self.root == '/'. 2006-07-25 11:09:17 -07:00
Vadim Gelfer
9738466350 status: add -c (clean) and -A (all files) options
also add new localrepo.status what is more uniform than localrepo.changes.
localrepo.changes is deprecated and will go away soon.
2006-07-20 16:21:07 -07:00
Matt Mackall
4e6cb39019 Start using manifestflags methods 2006-07-16 03:14:17 -05:00
Benoit Boissinot
231afefcb6 simplify filterfiles when filtering based on a directory
since an unkown files cannot be an exact match, we bisect
for a <path>/ instead of <path> and we get only the files
below the directory.
2006-06-23 08:09:48 +02:00
Brendan Cully
4c25b98467 filterfiles: Search as long as the target is a prefix of current.
filterfiles was failing to find files for directory arguments if
another file existed that started with the directory name and
sorted earlier. For example, a manifest of ('foo.h', 'foo/foo')
would cause filterfiles('foo') to return nothing. This resolves
issue #294.
2006-06-23 00:11:53 +02:00
Vadim Gelfer
9a0c813fdc use demandload more. 2006-06-20 23:58:21 -07:00
Vadim Gelfer
6144b74dd7 replace os.stat with os.lstat in some where. 2006-06-16 12:58:24 -07:00
Vadim Gelfer
ae14071210 dirstate: fix call to os.lstat when st is None 2006-06-13 14:56:01 -07:00
Vadim Gelfer
a7a6090062 dirstate.read: make 15% faster.
time to read dirstate for my kernel repo goes from 0.22s to 0.18s.
2006-06-12 22:09:50 -07:00
Vadim Gelfer
6ee0c5dc9f dirstate: speed up inner loop of read. 2006-06-12 09:36:23 -07:00
Benoit Boissinot
72acadbf1d dirstate: refactor the dirstate binary format, remove magic numbers 2006-06-04 02:25:27 +02:00
Vadim Gelfer
9dc134b879 benoit asked for comment to make avoid of recursive repo clearer. 2006-04-13 13:46:05 -07:00
Vadim Gelfer
384a97c85e merge with crew. 2006-04-13 12:44:40 -07:00
Vadim Gelfer
0279e68d84 small changes to revert command.
fix bug 93: work with files that are in target manifest but not
dirstate.
2006-04-03 10:02:09 -07:00
Vadim Gelfer
16c52d7c61 support nested repositories.
mercurial will not recurse into a subdirectory that contains a .hg
directory. it is treated as a separate repository.
2006-03-31 17:00:09 -08:00
Thomas Arendsen Hein
f0fd01b209 New option -i/--ignored for 'hg status' to show ignored files.
localrepo.changes() now returns an additional list of ignored files if
it is called with show_ignored=True.
2006-03-29 22:58:34 +02:00
Thomas Arendsen Hein
2aaeef325d Don't ignore everything if all hgignore files are empty. 2006-03-26 22:32:44 +02:00
Thomas Arendsen Hein
694e91d66d Show reason why an ignore file can't be read and state that it is skipped. 2006-03-25 10:31:06 +01:00
mcmillen@cs.cmu.edu
eb8285512e On error parsing hgignore file, print the correct filename. 2006-03-25 10:12:23 +01:00
mcmillen@cs.cmu.edu
33e91a5d4e Add warning if user-configured hgignore file isn't found 2006-03-25 10:02:39 +01:00
mcmillen@cs.cmu.edu
dc6517d798 Implementation of per-user .hgignore.
Reference: http://www.selenic.com/mercurial/bts/issue166

If the [ui] section of .hgrc contains keys like "ignore" or
"ignore.something", the values corresponding to these keys are
treated as per-user hgignore files. These hgignore files apply to all
repositories used by that user.
2006-03-24 20:18:02 +01:00
Benoit Boissinot
b04984b4a2 only write the dirstate when something changed 2006-02-23 02:17:08 +01:00
Benoit Boissinot
aa994e6598 add 'debugrebuildstate' to rebuild the dirstate from a given revision
- added and removed files will be lost while recreating the dirstate
- modifications are not lost
2006-02-20 19:04:56 +01:00
Benoit Boissinot
9ea87984bc fix warnings from pychecker (unused variables and shadowing) 2006-02-19 19:43:03 +01:00
Thomas Arendsen Hein
ac4248da86 Make localrepo.changes() internally distinguish between removed and deleted. 2006-01-12 12:22:28 +01:00
Vadim Gelfer
859b47ca42 if hgignore contains errors, print message that is not confusing. 2006-01-02 15:48:16 -08:00
Benoit Boissinot
c6b2943998 Re: [PATCH 2 of 3] remove walk warning about nonexistent files
On 11/15/05, Robin Farine <robin.farine@terminus.org> wrote:
> # HG changeset patch
> # User Robin Farine <robin.farine@terminus.org>
> # Node ID ce0a3cc309a8d1e81278ec01a3c61fbb99c691f4
> # Parent  feb77e0951e74d75c213e8471f107fdcc124c876
> remove walk warning about nonexistent files
>
> diff -r feb77e0951e7 -r ce0a3cc309a8 mercurial/dirstate.py
> --- a/mercurial/dirstate.py     Tue Nov 15 08:42:45 2005 +0100
> +++ b/mercurial/dirstate.py     Tue Nov 15 08:59:50 2005 +0100
> @@ -336,9 +336,6 @@
>              try:
>                  st = os.lstat(f)
>              except OSError, inst:
> -                if ff not in dc: self.ui.warn('%s: %s\n' % (
> -                    util.pathto(self.getcwd(), ff),
> -                    inst.strerror))
>                  continue
>              if stat.S_ISDIR(st.st_mode):
>                  cmp1 = (lambda x, y: cmp(x[1], y[1]))

this break some tests,
a better fix would be to check if ff can be a directory prefix from files in dc

you can try the attached patch.

Benoit
2005-12-01 10:48:29 -06:00
Christian Boos
b837e9f668 Fix walkhelper on windows.
The ''seen'' dictionary stores paths in canonical form,
so the walkhelp must also provide paths in that form,
otherwise the changed files are listed twice.
2005-12-01 10:48:18 -06:00
Eric Hopper
dd6718fc31 Convert all classes to new-style classes by deriving them from object. 2005-11-18 22:48:47 -08:00
twaldmann@thinkmo.de
55d74a6b77 fixed some stuff pychecker shows, marked unclear/wrong stuff with XXX 2005-11-14 03:59:35 +02:00
Benoit Boissinot
0406904c8d add dirstate.lazyread, write atomically the dirstate
- add a dirstate.lazyread function that read only if it wasn't read before and
  update all callers
- use the atomic keyword from util.opener to atomically write the dirstate
mercurial/dirstate.py
2005-11-11 15:34:06 -08:00
Benoit Boissinot
0bb141c937 don't print anything about file of unsupported type unless
the file was specified on the command line
2005-11-11 15:33:08 -08:00
Benoit Boissinot
b39fbd5ced use self.{w,}join when possible 2005-11-08 10:34:50 -08:00