Commit Graph

164 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