Commit Graph

364 Commits

Author SHA1 Message Date
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
Benoit Boissinot
9db56d4cdb fix a bug in dirstate.changes when cwd != repo.root
- use lstat instead of stat
- add a testcase (thanks to Johannes Hofmann)
2005-11-02 16:13:41 -08:00
Benoit Boissinot
02edb6c65e only files in normal state should be marked as deleted
fix a traceback when you removed an added file
2005-11-02 16:08:48 -08:00
Benoit Boissinot
0bbf5d2b87 fix handling of files of unsupported type in the walk code
if a file was of unsupported type, it was considered as 'seen' while
walking. this way it was possible to have file in the dirstate not
yielded by the walk function.
2005-11-02 15:46:31 -08:00
Benoit Boissinot
64b4619845 fix dirstate.change: it should walk ignored files 2005-10-28 10:57:40 -07:00
Benoit Boissinot
1a6aabcbb0 rewrote changes function in dirstate to use generic walk code
now, file with unsupported type will not show up in status anymore
2005-10-27 13:29:35 -07:00
Benoit Boissinot
06e39e559b i18n part2: use '_' for all strings who are part of the user interface 2005-10-18 18:38:39 -07:00
Benoit Boissinot
e38e94088a i18n first part: make '_' available for files who need it 2005-10-18 18:37:48 -07:00
Benoit Boissinot
809d7cd761 check if a file is ignored before complaining if it is an unsupported type 2005-10-18 00:45:27 -07:00
Matt Mackall
3806a62caf dirstate: make sure we read the dirstate before setting parents 2005-10-18 00:43:19 -07:00
Benoit Boissinot
027c44564c add a check for filetype when walking 2005-10-15 15:43:40 -07:00
Bryan O'Sullivan
1e033a9907 Fix dirstate.changes for ignored directories.
Do a second walking pass to examine any leftover files in the dirstate
map that are in the .hgignore file but match our search criteria.
This fixes the case of entire directories never being examined due to
their presence in the .hgignore file, and should hopefully not add any
significant overhead.
2005-09-18 15:03:07 -07:00
Bryan O'Sullivan
9fd20230a1 Fix ignore regression.
An empty or non-existent hgignore file must return False (don't
ignore) for everything.
2005-09-17 00:37:14 -07:00
Bryan O'Sullivan
ae02dc4df3 Switch to new syntax for .hgignore files.
Here is the new syntax, in summary.
Trailing white space is dropped.
The escape character is "\".
Comments start with #.
Empty lines are skipped.
Lines can be of the following formats:
syntax: regexp # defaults following lines to non-rooted regexps
syntax: glob   # defaults following lines to non-rooted globs
re:pattern     # non-rooted regular expression
glob:pattern   # non-rooted glob
pattern        # pattern of the current default type
The default pattern type is regexp, which is completely backwards
compatible with the old hgignore syntax.
In the dirstate class, the ignore method has been reworked to be based
on the util.matcher function, by way of a new dirstate.hgignore
method.
2005-09-17 00:27:27 -07:00
Bryan O'Sullivan
1ccdac3a1b Fix performance of dirstate.changes with ignored directories. 2005-09-17 00:23:19 -07:00
Chris Mason
329f781b37 Files not getting added appropiately
On Wed, 14 Sep 2005 15:15:13 -0400
Daniel Santa Cruz <byteshack@gmail.com> wrote:

> c:> hg debugstate
> a 666          0 09/14/05 15:11:44 a/aa\aa.a
> a 666          0 09/14/05 15:11:47 a/aa\aa.b  <---- notice mixed
> slashes
>
> This all seems very confusing....

Please try this:
2005-09-14 15:50:31 -05:00
mpm@selenic.com
e271f138e7 dirstate: two more stat -> lstat changes 2005-09-09 12:17:51 -07:00
mpm@selenic.com
9580bfb453 Fix dangling symlink bug in dirstate walk code 2005-09-09 11:46:35 -07:00
mpm@selenic.com
3e01e32fbe Fix Windows status problem from new dirstate walk code 2005-09-08 15:01:33 -07:00
mason@suse.com
e8acfdbc0a Optimize dirstate walking
This generally cuts the time for hg status/diff in half, from 2s down to 1s.
The main parts I'm trying to optimize are:

1) os.walk stats every file.  dirstate.changes then stats every file again.

2) os.walk yields every file and subdir to dirstate.traverse who yields every
file and everything in the dirstate map.  dirstate.walk then
filters this mass and yields every file to the caller.  There should be
fewer steps in here, and fewer duplicate strings yielded.

3) dirstate.walk runs util.unique on the results from dirstate.traverse,
even though it is also passing things through dirstate.seen to look for
duplicates.

I've turned os.walk into something hg specific that takes all the dirstate
ignore and matching rules into account.  The new function also takes an
function arg (statmatch()) the caller supplies to help filter out
files it doesn't care about.  dirstate.changes uses this to update state
for each file, avoiding the second stat call.

dirstate.walk is changed to turn the match function it is passed into
a statmatch function.  The only real difference is that a statmatch
function takes the stat data as a second parameter.  It now calls
dirstate.walkhelper, who requires a statmatch function to be passed.

This fails test-walk, but right now I think this is from a sorting error
fixed by this patch.

Index: crew/mercurial/dirstate.py
===================================================================
2005-09-01 07:34:53 -07:00
mpm@selenic.com
7f0689647a fix some rename/copy bugs
- delete copy information when we update dirstate

  hg was keeping the copy state and marking things as copied on
  multiple commits

- files that are renamed should have no parents

  if you do a rename/copy to an existing file, it should not be marked
  as descending from its previous revisions.

- remove spurious print from filelog.renamed

- add some more copy tests
2005-08-27 22:04:17 -07:00
mpm@selenic.com
49950bfbc2 Fix dirstate imports 2005-08-27 16:42:03 -07:00
mpm@selenic.com
016db4f3e8 Adjust some imports 2005-08-27 14:59:25 -07:00
mpm@selenic.com
e175fdde9b Break apart hg.py
- move the various parts of hg.py into their own files
- create node.py to store node manipulation functions
2005-08-27 14:21:25 -07:00