Commit Graph

309 Commits

Author SHA1 Message Date
Matt Mackall
56c9dee4e1 context: add a dirty method to detect modified contexts 2009-06-04 16:21:55 -05:00
Augie Fackler
678623416a dirstate: don't check state of subrepo directories 2009-12-31 17:19:30 -06:00
Benoit Boissinot
0c85bdcee0 context: parents() already filters nullid 2009-12-01 01:08:16 +01:00
Benoit Boissinot
e4e6f5d929 context: use key-sorting instead of tuples 2009-12-01 01:03:54 +01:00
Benoit Boissinot
37cf6c6d68 workingfilectx: always use the same filelog, even for renames
workingfilectx() was using the "src" filelog in case the file was renamed in
the working copy.
For consistency, stop special-casing it. This allows us to remove some
duplication between filectx and workingfilectx.
2009-05-20 02:08:53 +02:00
Martin Geisler
0a365d5ca2 use 'x is None' instead of 'x == None'
The built-in None object is a singleton and it is therefore safe to
compare memory addresses with is. It is also faster, how much depends
on the object being compared. For a simple type like str I get:

            | s = "foo" | s = None
  ----------+-----------+----------
  s == None | 0.25 usec | 0.21 usec
  s is None | 0.17 usec | 0.17 usec
2009-05-20 00:52:46 +02:00
Matt Mackall
188df2eaa9 context: add new manifestnode method 2009-05-14 13:21:20 -05:00
Matt Mackall
9a5dcd2974 context: add p1 and p2 methods 2009-05-14 13:20:40 -05:00
Matt Mackall
49e6e0b6c0 filecommit: swallow some bits from _commitctx, add _ 2009-05-14 13:20:40 -05:00
Simon Heimberg
df774ad0e5 context: replace pseudo-set by real set 2009-05-14 10:59:55 +02:00
Simon Heimberg
09ac1e6c92 separate import lines from mercurial and general python modules 2009-04-28 17:40:46 +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
Matt Mackall
9ec97bdefe util: take propertycache from context.py 2009-04-26 16:50:44 -05:00
Martin Geisler
3ce0ca846d context: use Python 2.4 decorator syntax 2009-04-24 18:47:15 +02:00
Martin Geisler
44aa7e92d1 util: use built-in set instead of util.unique 2009-04-22 00:56:06 +02:00
Patrick Mezard
cd3505dbbc Merge with crew-stable 2009-04-13 21:57:17 +02:00
Patrick Mezard
4764779700 context: fix workingctx.__contains__ 2009-04-13 19:47:11 +02:00
Peter Arrenbrecht
a2d3e23eef cleanup: drop variables for unused return values
They are unnecessary. I did leave them in localrepo.py where there is
something like:

  _junk = foo()
  _junk = None

to free memory early. I don't know if just `foo()` will free the return
value as early.
2009-03-23 13:13:02 +01:00
Matt Mackall
d15d559b7c errors: move revlog errors
- create error.py for exception classes to reduce demandloading
- move revlog exceptions to it
- change users to import error and drop revlog import if possible
2009-01-11 22:48:28 -06:00
Patrick Mezard
6f86a4092b context: enforce memctx.files() unicity
localrepo.commitctx() expects changed files lists to contain unique items and
does not sort itself. Passing duplicates makes them evaluated more than once
and changes the committed changelog id.
2008-12-14 17:35:19 +01:00
Dirkjan Ochtman
d5bf581a69 context: use descriptors to speed up lazy attributes 2008-11-14 12:44:26 +01:00
Dirkjan Ochtman
c8e4c03aa9 context: special-case changectx setup for integer changeid 2008-11-13 21:09:51 +01:00
Matt Mackall
b2807810c6 linkrev: take a revision number rather than a hash 2008-11-12 15:19:14 -06:00
Patrick Mezard
ad3b5c4ec9 context: improve memctx documentation 2008-10-11 13:07:29 +02:00
Peter Ruibal
30a2036f9e use Exception(args)-style raising consistently (py3k compatibility) 2008-09-08 13:07:00 +02:00
Matt Mackall
08b29d9875 Merge with stable
Simplify the copy search algorithm
2008-08-10 18:38:43 -05:00
Dirkjan Ochtman
26b9b92409 context: get rid of unused changectx.filectxs() method 2008-07-21 13:26:42 +02:00
Dirkjan Ochtman
6b15d82e07 context: fix workingctx's __contains__ method 2008-07-21 13:22:11 +02: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
8cb2b4a288 dirstate.walk: push sorting up 2008-07-22 13:03:19 -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
Matt Mackall
b4ff221e3e minor status fixups 2008-07-22 13:00:22 -05:00
Patrick Mezard
c2be161a5c context: trigger missing username warning only when necessary 2008-07-20 19:09:00 +02:00
Matt Mackall
b161cadfc8 context: simplify parents code 2008-07-11 18:46:02 -05:00
Matt Mackall
644a7f906e workingctx: add __contains__ method 2008-07-11 18:46:02 -05:00
Matt Mackall
f1402a6652 context: add walk method 2008-06-27 19:25:48 -05:00
Matt Mackall
087987c8d8 context: add __int__ and hex methods 2008-06-27 18:44:43 -05:00
Matt Mackall
a65ef7bc5d util: add sort helper 2008-06-27 18:28:45 -05:00
Matt Mackall
d4ab55a92b status: clean up all users for unknown files 2008-06-27 13:43:29 -05:00
Matt Mackall
fbb5127472 use repo[changeid] to get a changectx 2008-06-26 14:35:46 -05:00
Matt Mackall
25b1f97147 context: remove islink and isexec methods 2008-06-26 13:52:16 -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
Matt Mackall
2bd0fe0371 context: clean up parents() 2008-06-26 13:46:33 -05:00
Matt Mackall
2d2ae68ba8 context: simplify changeid logic 2008-06-26 13:46:31 -05:00
Matt Mackall
0a211cf39a context: consistently return p1 context for None 2008-06-25 17:33:51 -05:00
Dirkjan Ochtman
b5da46f6f1 kill some trailing spaces 2008-06-23 13:12:32 +02:00
Christian Ebert
11232ed4ba Fix commit date (issue1193)
The None check in workingctx prevents calling util.makedate
when date is not explicitly given.
2008-06-21 15:27:51 +02:00
Patrick Mezard
1ae4077ddd context: add memctx for memory commits 2008-06-19 00:14:23 +02:00
Patrick Mezard
67c45a2700 context: let workingctx.date(), .user() and description() be overriden 2008-06-18 22:52:26 +02:00
Patrick Mezard
767445bf63 localrepo: let commit() get extra data from workingctx 2008-06-18 22:52:26 +02:00
Patrick Mezard
f2fb1d0609 localrepo: hide commit() file selection behind workingctx 2008-06-18 22:52:25 +02:00
Patrick Mezard
d184e29b1c context: let workingctx parents be overriden 2008-06-18 22:52:25 +02:00
Patrick Mezard
1fa87a95fd Merge with crew-stable 2008-06-15 13:05:39 +02:00
Patrick Mezard
af038bed31 context: fix workingctx.fileflags() execute bit 2008-06-15 13:01:01 +02:00
Patrick Mezard
91d2df2c77 Merge with crew-stable 2008-04-12 21:34:01 +02:00
Patrick Mezard
3409e6fdc3 context: handle untracked files in filectx.fileflags() 2008-04-12 21:08:03 +02:00
Paul Moore
0046a32c4b python 2.6 compatibility: add __hash__ to classes that have __eq__ 2008-04-04 22:41:17 +02:00
Alexis S. L. Carvalho
dd492604df filectx.ancestor: use fctx._repopath to cache filelogs (issue1035)
_repopath may be different from _path for workingfilectx when there
are renames involved.
2008-03-16 06:10:47 -03:00
Matt Mackall
865487e7f2 revlog: report node and file when lookup fails 2008-03-11 17:42:29 -05: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
deb94bc7fe Removed trailing spaces from everything except test output 2008-03-07 00:24:36 +01:00
Patrick Mezard
4b9a547de4 context: fix filectx.parents() bug introduced when editing 3fb82bcfc6e3 2008-01-06 15:40:32 +01:00
Maxim Dounin
4d9877b4eb Fix copies reporting in log and convert.
If copy logged in file revision, we report copy for changeset only
if file revisions linkrev points back to the changeset in question
or both changeset parents contain different file revisions.

This fixes extra copies reported when executable bit was changed for
previously copied file.
2007-12-29 17:11:48 +03:00
Maxim Dounin
940a0afd31 context: preserve changeset in filectx if we have one
If we know original changeset we are working with - try hard to
preserve it. Fallback to filelog.linkrev() only if we have no way
to get original changeset, since linkrev() may point to other
changeset.
2007-12-29 16:57:43 +03:00
Thomas Arendsen Hein
347da85c36 Removed tabs and trailing whitespace in python files 2007-12-29 19:49:48 +01:00
Bryan O'Sullivan
d32d6fb57f make LookupError more detailed 2007-11-28 08:36:55 -08:00
Bryan O'Sullivan
2a0ef5ab06 Fix context iterator. 2007-11-02 14:44:33 -07:00
Bryan O'Sullivan
6df62fb77c convert: make contents of "extra" dict available from sources, for sinks.
This breaks hash preservation for hg->hg conversion, as each converted
change gets a convert_revision item added to its extra dict.  Ugh.
2007-10-10 15:30:00 -07:00
Patrick Mezard
2dee2a1086 Fix workingctx exec/link bit of copies on non-supporting systems 2007-10-07 15:07:35 +02:00
Patrick Mezard
8102777e5e Fix bad lambda prototype in workingctx.fileflags() 2007-10-06 17:54:33 +02:00
Patrick Mezard
904ffeda9f context: add fileflags() to avoid rebuilding manifests 2007-10-05 23:01:38 +02:00
Matt Mackall
410e8d67c6 context: add __contains__, __getitem__, and __iter__ 2007-07-21 16:02:09 -05:00
Matt Mackall
642976187f contexts: improve filectx eq test 2007-07-16 17:39:03 -05:00
FUJIWARA Katsunori
03774e057f Allow filectx.annotate to return the line number of first appearance. 2007-07-08 19:46:04 +02:00
Matt Mackall
cfe7a0a522 merge: make test for fast-forward merge stricter (issue619)
don't allow merging with an ancestor
fix != on contexts
add a test
2007-07-05 13:34:18 -05:00
Matt Mackall
7be33e5057 context: add tags() method 2007-06-21 11:42:39 -05:00
Patrick Mezard
0b90ff3d83 Merge with crew-stable 2007-06-20 00:22:51 +02:00
Patrick Mezard
aae84719a5 Fix issue 589: "undelete" sequence leads to crash. 2007-06-20 00:10:21 +02:00
Thomas Arendsen Hein
4d29c6dc8e Updated copyright notices and add "and others" to "hg version" 2007-06-19 08:51:34 +02:00
Matt Mackall
5fa7270b2d Merge with stable 2007-05-08 11:42:48 -05:00
Matt Mackall
d4deb74aa1 context: fix workingfilectx._changectx 2007-05-07 22:30:36 -05: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
Matt Mackall
19d825d10e Minor default branch cleanups 2007-03-13 15:47:55 -05:00
Alexis S. L. Carvalho
fd69fe8d91 "default" is the default branch name 2007-03-13 15:02:33 -03:00
Thomas Arendsen Hein
d104165f50 Use only integer part of mtime in workingfilectx.date(), fixes test-context.py
Similar to what is done in dirstate.status() (changeset db96436edaee)
and has to be removed when Mercurial switches to subsecond granularity.
2007-02-26 21:57:33 +01:00
Thomas Arendsen Hein
c20f16ea94 Fixed workingfilectx.date() (found by Thomas Waldmann) with test. 2007-02-23 17:31:00 +01:00
Matt Mackall
2e27ddd82b symlinks: use is_link wherever is_exec is used 2006-12-29 20:04:31 -06:00
Matt Mackall
b875ad6c04 exec: add execfunc to simplify exec flag support on non-exec filesystems 2006-12-29 20:04:30 -06:00
Benoit Boissinot
35f1d19852 context: create a filectxt with filelog reuse 2006-12-25 18:57:55 +01:00
Benoit Boissinot
a8be9617b4 context: fix a bug in workingfilectx.renamed 2006-12-25 17:43:47 +01:00
Benoit Boissinot
6b47271f10 make it possible to use changectx to create a filectx 2006-12-25 17:43:44 +01:00
Benoit Boissinot
36bf020419 add date attribute to workingfilectx 2006-12-24 22:55:34 +01:00
Benoit Boissinot
6c61f6a933 fix tab vs space 2006-12-24 22:29:29 +01:00
Brendan Cully
8a6eea2483 Add revlog.LookupError exception, and use it instead of RevlogError.
Remove repo.LookupError, which devolves to the revlog version.
2006-12-18 12:22:43 -08: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
Matt Mackall
6148417831 context: don't spuriously raise abort when a file goes missing. 2006-12-08 13:14:57 -06:00
Brendan Cully
261404dfe1 Make context __eq__ handle arbitrary RHS values 2006-11-27 15:27:09 -08:00
Benoit Boissinot
97597496aa context: None is not a valid filenode (revert from ae31fe77b54b) 2006-11-27 20:55:50 +01:00
Thomas Arendsen Hein
411d64ce3e white space and line break cleanups 2006-11-17 08:06:54 +01:00
Thomas Arendsen Hein
687e4a7111 Define and use nullrev (revision of nullid) instead of -1. 2006-10-29 10:53:51 +01:00
Matt Mackall
e8cb00b8c7 filecontext: report False for missing files 2006-10-18 14:06:48 -05:00
Matt Mackall
bd3a8da1a7 Merge with crew 2006-10-17 18:54:37 -05:00
Matt Mackall
506e5e54f6 Add branch method to contexts 2006-10-17 18:30:12 -05:00
Brendan Cully
7761a89cfe Fix annotate where linkrev != rev without exporting linkrev 2006-10-15 18:43:46 -07:00
Brendan Cully
63d34eb36b Back out da2c890e2644 and 278eadc04b61 2006-10-15 18:25:07 -07:00
Brendan Cully
bcf56af444 Add linkrev to filectx 2006-10-15 17:37:04 -07:00
Matt Mackall
e5ce68c388 Merge with crew 2006-10-11 17:37:48 -05:00
Brendan Cully
fb4e783895 changectx: search manifest delta for filenode 2006-10-11 13:56:35 -07:00
Brendan Cully
a3547ef308 context: check self.__dict__ instead of using hasattr
hasattr implicitly calls getattr, instantiating the field it is
checking for.
2006-10-11 13:34:12 -07:00
Giorgos Keramidas
b10311c5e9 Revert changeset d48690da3368.
It breaks 'hg merge && hg up -c REV' when files exist only in one of the
manifests, making hg throw a traceback like:
2006-10-10 21:03:24 +03:00
Matt Mackall
208002d0f3 context: change workingctx str() from . to <node>+ 2006-10-10 02:11:59 -05:00
Matt Mackall
87112abb50 context: add cmp for filectxs 2006-10-10 01:13:03 -05:00
Matt Mackall
7ac4f59673 filectx: add size method 2006-10-09 23:20:48 -05:00
Matt Mackall
12c8fcfa84 fix workingfilectx parents and ancestor functions 2006-10-09 21:04:25 -05:00
Brendan Cully
a7aa2299e4 Make changectx.filenode raise repo.LookupError on failure 2006-10-03 12:28:27 -07:00
Brendan Cully
de0df5a89b Merge with upstream 2006-10-03 12:14:33 -07:00
Matt Mackall
93a98b345e merge: use new working context object in update 2006-10-03 01:21:46 -05:00
Matt Mackall
2f06faadef contexts: add working dir and working file contexts
add workingctx
add workingfilectx
extend filectx.annotate for rev=None
extend filectx.ancestor
2006-10-02 22:03:14 -05:00
Brendan Cully
60d934ae0f Use parentrevs shortcut in filectx.annotate 2006-10-02 17:59:39 -07:00
Matt Mackall
3b7d2a1d20 context: simplify repr methods 2006-10-02 15:28:44 -05:00
Matt Mackall
3ad8369e36 contexts: use __getattr__ rather than try/except in changectx 2006-10-02 15:17:59 -05:00
Matt Mackall
beacc65a8c context: make filectx remember changectx in changectx.filectx 2006-10-02 15:02:28 -05:00
Matt Mackall
5a468e160f Make filectx lazier
Lazy opening of filelog, lazy lookup of filenode and changeid
2006-10-02 14:23:38 -05:00
Brendan Cully
41ed405b40 Make filectx.__init__ use LookupError 2006-10-01 13:44:08 -07:00
Brendan Cully
238f3e6fdc Raise LookupError in changectx.filectx if filenode can't be found 2006-10-01 12:42:50 -07:00
Thomas Arendsen Hein
0a7b982aa6 Whitespace/Tab cleanup 2006-10-01 19:26:33 +02:00
Thomas Arendsen Hein
a559deaa8e merged brendan's hgweb cleanups 2006-09-30 12:34:31 +02:00
Thomas Arendsen Hein
5110ed5266 Merge with upstream 2006-09-30 09:46:03 +02:00
Brendan Cully
9c70192d20 Add lookup method to filectx 2006-09-29 16:26:09 -07:00
Matt Mackall
7af52acdea context: add __nonzero__ methods 2006-09-29 17:47:51 -05:00
Matt Mackall
8f8ebdaa02 Add str methods to contexts 2006-09-29 16:29:44 -05:00
Matt Mackall
a664a3c8b3 Add equality operators to changectx and filectx 2006-09-29 16:01:46 -05:00
Brendan Cully
2946d7faed Refactor annotate copy support. 2006-09-27 09:10:21 -07:00
Matt Mackall
05740b8ef1 context: change filectx repr to use @
Avoids confusion with rev:nodeid syntax used elsewhere
2006-09-25 16:43:21 -05:00
Matt Mackall
5fc766530e context: add __repr__ methods 2006-09-22 16:12:39 -05:00
Matt Mackall
bcf2c903fb filectx: lazy linkrev usage 2006-09-22 16:01:14 -05:00
Matt Mackall
5673fe334f restore filectx.changectx() method 2006-09-22 15:34:02 -05:00
Brendan Cully
15222c4792 filectx.annotate: return filectx for each line instead of rev 2006-09-22 08:19:25 -07:00
Brendan Cully
5e02efd5d4 Make filectx lazier - some users never use filenode 2006-09-22 08:19:25 -07:00
Brendan Cully
684cd993b8 context: handle fileid or changeid == 0 2006-09-22 08:19:25 -07:00
Matt Mackall
79aed53c85 Abstract ancestor algorithm into generic function
Make depth calculation non-recursive
Add simple shortcut for linear ancestry

Convert context to use ancestor function
 make memoized parents function

Convert revlog to use ancestor function
2006-09-20 16:50:50 -05:00
Matt Mackall
01ca9fd363 Merge with crew 2006-09-19 15:28:13 -05:00
Matt Mackall
0650997740 filectx: add rename-aware ancestor algorithm
This code works but may trigger recursion depth issues
2006-09-19 14:58:54 -05:00
Matt Mackall
19ce6dc65c changectx: add ancestor function 2006-09-17 22:59:33 -05:00
Matt Mackall
ce81b072ef filectx: allow passing filelog in init to avoid opening new filelogs 2006-09-17 22:58:11 -05:00
Matt Mackall
50e42b8388 filelog: make metadata method private 2006-09-17 22:38:06 -05:00
Matt Mackall
06695a7cb9 filectx: add rename traversal for parents() 2006-09-17 22:20:44 -05:00
Brendan Cully
8104550ace Move defaultrev into changectx
This also causes tag on a repository with no working directory
to default to tip.
2006-09-15 15:23:52 -07:00
Vadim Gelfer
dc377b58c1 update copyrights. 2006-08-12 12:30:02 -07:00
Benoit Boissinot
bb31345eb8 fix filectxt to really work
- use a context instead of changelog.read
- changectx._id is not necessary
2006-07-17 01:59:06 +02:00
Benoit Boissinot
788bbdea72 context.py: various fixes
- use a normal changeset instead of a context
- define _filenode instead of _node to match the else clause
2006-07-16 16:40:24 +02:00
Benoit Boissinot
fe197b5f4f context.py: filectxs was using a keyword arg, add it to filectx 2006-07-16 16:39:03 +02:00
Benoit Boissinot
d9acb13f0c context.py: self.repo is not defined, change to self._repo 2006-07-16 16:39:02 +02:00
Matt Mackall
b2760f583c Convert hg annotate to context api 2006-06-28 17:42:17 -05:00
Matt Mackall
092ee51a9a Add context.py: changeset and file revision contexts 2006-06-28 17:07:46 -05:00