Commit Graph

213 Commits

Author SHA1 Message Date
Matt Mackall
8b31da4540 branch: operate on branch names in local string space where possible
Previously, branch names were ideally manipulated as UTF-8 strings,
because they were stored as UTF-8 in the dirstate and the changelog
and could not be safely converted to the local encoding and back.

However, only about 80% of branch name code was actually using the
right encoding conventions. This patch uses the localstr addition to
allow working on branch names as local strings, which simplifies
handling so that the previously incorrect code becomes correct.
2010-11-24 15:56:32 -06:00
Martin Geisler
6a3d9310ab code style: prefer 'is' and 'is not' tests with singletons 2010-11-22 18:15:58 +01:00
Matt Mackall
437f851e8f merge with stable 2010-11-15 17:05:54 -06:00
Matt Mackall
51394cd31b context: walk both parents for workingctx.ancestors() 2010-11-15 17:00:43 -06:00
Nicolas Dumazet
7adc6dc3ec context: add __repr__ methods to workingfilectx and workingctx 2010-11-07 18:59:27 +09:00
Christian Ebert
7790af9438 context: narrow down filter special case in filectx.cmp()
cmp via filelog when encode filters are present, but only when
actually comparing to the working directory.
2010-10-14 22:47:50 +02:00
Nicolas Dumazet
04cf1f6b57 filectx: use ctx.size comparisons to speed up ctx.cmp
Comparing sizes is cheaper than comparing file contents, as it does not
involve reading the file on disk or from the filelog.

It is however not always possible: some extensions, or encode filters,
change data when extracting it to the working directory.
2010-07-27 23:07:30 +09:00
Patrick Mezard
44b002a617 Merge with stable 2010-09-21 23:37:47 +02:00
Patrick Mezard
aebd1a7052 context: fix filectx.undelete() (issue2388) 2010-09-21 23:14:58 +02:00
Patrick Mezard
614db673f4 Merge with stable 2010-09-20 22:29:13 +02:00
Patrick Mezard
979ccf4590 Use lexists() instead of exists() where appropriate 2010-09-20 21:46:56 +02:00
Martin Geisler
cb93a10b9b add: recurse into subrepositories with --subrepos/-S flag 2010-09-13 13:09:20 +02:00
Martin Geisler
5f46f16fb7 Lowercase error messages 2010-08-29 22:37:58 +02:00
Martin Geisler
cb36142754 Merge with stable 2010-08-29 22:55:37 +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