Commit Graph

201 Commits

Author SHA1 Message Date
Martin Geisler
cb36142754 Merge with stable 2010-08-29 22:55:37 +02:00
Martin Geisler
5f46f16fb7 Lowercase error messages 2010-08-29 22:37:58 +02:00
Martin Geisler
2d00197a3e Merge with stable 2010-08-25 13:40:46 +02:00
Martin Geisler
e215b992dc context: mark string for translation 2010-08-25 13:29:46 +02:00
Martin Geisler
174c3dbb8d subrepos: support remapping of .hgsub source paths
Given a .hgsub file containing

  lib/libfoo = http://server/libfoo

the 'lib/libfoo' subrepo will be cloned from 'http://server/libfoo'.

This changeset introduces a remapping mechanism whereby the source
paths (the right-hand sides) in the .hgsub file can be remapped. This
subpaths section

  [subpaths]
  http://server = /local

will result in the 'lib/libfoo' subrepo being cloned from
'/local/libfoo' instead of from 'http://server/libfoo'.

The patterns (left-hand sides) are really regular expressions and the
replacement strings (right-hand sides) can refer to matched groups
using normal backreferences. This can be used for more complicated
replacements such as

  [subpaths]
  http://server/(.*)-hg/ = http://hg.server/\1/

which replaces 'http://server/foo-hg/' with 'http://hg.server/foo/'.

All patterns are applied in the order by which they are listed in the
config files.
2010-07-15 18:10:05 +02:00
Nicolas Dumazet
659bdb87ec context: reuse filecontext.cmp in workingfilecontext.cmp
Same code path should mean less mistakes, and hopefully, better
caching.
2010-07-29 10:39:59 +09:00
Nicolas Dumazet
064d677bd7 filectx: use cmp(self, fctx) instead of cmp(self, text)
This allows more flexibility in implementation, and in particular,
lets the context decide if revision text has to be loaded or not.
2010-07-27 23:40:46 +09:00
Nicolas Dumazet
631c3ba3c4 context: use os.lstat instead of os.stat to fetch file size
When file is a link, we want the size of the link itself, not the size
of the file it points to.
2010-07-16 16:33:55 +09:00
Nicolas Dumazet
6e75efdbcb cmp: document the fact that we return True if content is different
This is similar to the __builtin__.cmp behaviour, but still not
straightforward, as the dailylife meaning of a comparison usually is
"find out if they are different".
2010-07-09 11:02:39 +09:00
Nicolas Dumazet
d78df2ed54 workingfilectx.cmp: invert boolean return value
Apparently we mostly used filectx.cmp(workingfilectx.read()), so no error
was ever triggered, but since all cmp() methods return True when content
are different, that == should in fact be !=
2010-07-09 11:59:48 +09:00
Peter Arrenbrecht
3ecec5f671 context: allow passing the common cset ancestor to fctx.ancestor
This is used by the next patch to speed up merge.applyupdates.
2010-06-18 08:48:05 +02:00
Dirkjan Ochtman
af6b696f0f move working dir/dirstate methods from localrepo to workingctx 2010-06-07 20:03:32 +02:00
Alexander Solovyov
558ccfdb04 slightly improve memctx api 2010-05-01 15:00:21 +03:00
Benoit Boissinot
a627942638 merge with stable 2010-05-11 20:21:25 +02:00
Benoit Boissinot
80751fb4aa context: fallback function should not return None 2010-05-11 20:13:52 +02:00
Edouard Gomez
079690a146 subrepo: dirtiness checks should iterate over subrepos 2010-05-01 23:05:21 +02:00
Steve Borho
f15661a778 changectx: change diff() to accept keyword opts 2010-05-07 14:07:30 -05:00
Steve Borho
68abae61b6 changectx: use repo.ui diffopts, allow argument override 2010-05-07 10:59:11 -05:00
Matt Mackall
ad8006c15f context: only scan unknowns when needed 2010-05-05 20:21:57 -05:00
Matt Mackall
cb35f80674 context: use asserts for ignored and clean exceptions 2010-05-04 15:52:42 -05:00
Steve Borho
c9196798ff workingctx: use member variables to store ignored and clean
If some code tries to query ignored or clean files without first
calling the explicit status() method to query them, it will raise
an exception (indicating a software bug).
2010-05-04 15:02:55 -05:00
Steve Borho
ab2c41068e workingctx: add explicit status method, add ignored and fix clean
workingctx.clean() and memctx.clean() have both been returning ignored files
since their creation.  This patch fixes clean() while introducing a method for
querying ignored files.  The new status() method can be used to explicitly
override the default (fast) arguments used by the _status property.
2010-05-04 14:52:25 -05:00
Steve Borho
d1f3ff6382 context: add a changectx.diff() convenience function
With this function, extracting diffs becomes trivial:

repo = hg.repository(ui.ui(), path=root)
ctx = repo['tip']
for out in ctx.diff():  print out
2010-05-04 20:12:58 -05:00
Benoit Boissinot
a6309b7596 context: remove parents parameter to workingctx
it was needed before the refactor of commit, workingctx always uses the
dirstate now.
2010-04-21 01:18:31 +02:00
Benoit Boissinot
6fa67d00f9 filectx: _fileid isn't normalized, use _filenode instead
_fileid can be anything the lookup accepts (hex(node), node, rev, etc.), we
should use something stable for comparisons (like _filenode).
2010-04-19 20:30:31 +02:00
Benoit Boissinot
788c113d09 context: fix bug introduced in f2d764a0939e, path should be used 2010-04-16 01:57:32 +02:00
Benoit Boissinot
73bdc48646 workingctx: correctly compute the flag for noexec filesystems+merge
This bug happens if the filesystem doesn't support exec-bit, during merges,
for example in 0b01431fee25 on the hg repo.
If f is not in p1, but is in p2 and has the x-bit in p2, since the dirstate is
based on p1, and the FS doesn't support the exec-bit, the dirstate can't
"guess" the right bit.
We instead fix it in workingcontext.flags()/manifest.
2010-04-15 18:08:48 +02:00
Matt Mackall
8d99be19f0 many, many trivial check-code fixups 2010-01-25 00:05:27 -06:00
Matt Mackall
cd3ef170f7 Merge with stable 2010-01-19 22:45:09 -06:00
Matt Mackall
595d66f424 Update license to GPLv2+ 2010-01-19 22:20:08 -06:00
Matt Mackall
525da95fd6 copies: speed up copy detection
On some large repos, copy detection could spend > 10min using
fctx.ancestor() to determine if file revisions were actually related.
Because ancestor must traverse history to the root to determine the
GCA, it was doing a lot more work than necessary. With this
replacement, same status -r a:b takes ~3 seconds.
2010-01-19 22:20:05 -06:00
Matt Mackall
948fcf8eac merge: fix changectx.ancestor(workingctx) (issue1327) 2009-11-12 12:03:39 -06:00
Matt Mackall
010544e3e6 filectx: shortcut unrelated files in ancestor() (issue1327) 2009-11-07 14:07:45 -06:00
Matt Mackall
d1a9a67d84 merge: first part of fix for issue1327
When there are no renames involved, we shortcut to the changeset
ancestor. This resolves most cases.

Note that Mercurial's rename philosophy elsewhere is that a file's
name is signficant and rename data is only consulted when a file of
the same name is absent.
2009-11-07 14:07:45 -06:00
Greg Ward
889a9ffb8d cmdutil: changeset_printer: use methods of filectx/changectx.
This allows extensions that modify changeset metadata (e.g.
description) by overriding methods of changectx to get consistent
behavior from all log-like commands, regardless of whether templates
or styles are used. Without this, overriding changectx methods works
if you use styles or templates, but not with default log format.

This meant adding filectx.extra() for consistency with changectx.
2009-10-05 18:17:13 -04:00
Nicolas Dumazet
7eadbe8d42 for calls expecting bool args, pass bool instead of int
str.splitlines and email.message.as_string both expect a bool argument
defaulting at False: replace f(1) by f(True) and f(0) by f()
2009-07-13 09:50:26 +09:00
Matt Mackall
eb6cba34d7 Merge with stable 2009-07-09 19:49:02 -05:00
Matt Mackall
f5635aa406 filectx: add a hex method 2009-07-06 14:52:44 -05:00
Matt Mackall
e3dc8aa6db fix memory usage of revlog caches by limiting cache size [issue1639] 2009-07-09 17:10:07 -05:00
Greg Ward
acf5297c3a context: improve arg-checking assert. 2009-07-03 10:43:46 -04:00
Matt Mackall
fd08adf4d6 commit: recurse into subrepositories 2009-06-15 02:45:38 -05:00
Matt Mackall
ce2e49a0da subrepo: introduce basic state parsing 2009-06-15 02:45:38 -05:00
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