Commit Graph

136 Commits

Author SHA1 Message Date
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