Commit Graph

854 Commits

Author SHA1 Message Date
Wagner Bruna
0d89e80dea rollback, i18n: avoid parameterized message 2011-02-21 20:58:54 -03:00
Adrian Buehlmann
a8a418601f introduce new RequirementError (issue2649)
This improves the misleading error message

  $ hg identify
  abort: there is no Mercurial repository here (.hg not found)!

to the more explicit

  $ hg identify
  abort: requirement 'fake' not supported!

for all commands in commands.optionalrepo, which includes the identify
and serve commands in particular.

This is for the case when a new entry in .hg/requires will be defined
in a future Mercurial release.
2011-02-18 20:25:25 +01:00
Gilles Moris
dcdc58f0a5 rollback: clarifies the message about the reverted state (issue2628)
Previously, when rolling back a transaction, some users could be confused
between the level to which the store is rolled back, and the new parents
of the working directory.

  $ hg rollback
  rolling back to revision 4 (undo commit)

With this change:
  $ hg rollback
  repository tip rolled back to tip revision 4 (undo commit)
  working directory now based on revision 2 and 1

So now the user can realize that the store has been rolled back to an older
tip, but also that the working directory may not on the tip (here we are
rolling back the merge of the heads 2 and 1)
2011-02-10 09:03:06 +01:00
Martin Geisler
4009f00b54 remove unnecessary list comprehensions
These result lists were only built for the side effects, and so a
normal loop is just as good and more straight-forward.
2011-02-03 10:31:17 +01:00
Patrick Mezard
1e4894d773 commit: abort if a subrepo is modified and ui.commitsubrepos=no
The default behaviour is to commit subrepositories with uncommitted changes. In
my experience this is usually undesirable:

- Changes to dependencies are often debugging leftovers
- Real changes should generally be applied on the source project directly,
  tested then committed. This is not always possible, subversion subrepos may
  include only a small part of the source project, without the tests.

Setting ui.commitsubrepos=no will now abort commits containing such modified
subrepositories like:

  $ hg --config ui.commitsubrepos=no ci -m msg
  abort: uncommitted changes in subrepo sub

I ruled out the hook solution because it does not easily take --include/exclude
options in account. Also, my main concern is whether this flag could cause
problems with extensions. If there are legitimate reasons for callers to
override this behaviour (I could not find any), they might either override at ui
level, or we could add an argument to localrepo.commit() later.

v2:
- Renamed ui.commitsubs to ui.commitsubrepos
- Mention the configuration entry in hg help subrepos
2011-02-15 22:25:48 +01:00
Dan Villiom Podlaski Christiansen
ec590d5cd4 explicitly close files
Add missing calls to close() to many places where files are
opened. Relying on reference counting to catch them soon-ish is not
portable and fails in environments with a proper GC, such as PyPy.
2010-12-24 15:23:01 +01:00
Adrian Buehlmann
35765bcb3b fncachestore: defer updating the fncache file to a single file open
Defers updating the fncache file with newly added entries to the end of
the transaction (on e.g. pull), doing a single open call on the fncache
file, instead of opening and closing it each time a new entry is added
to the store.

Implemented by adding a new abstract write() function on store.basicstore
and registering it as a release function on the store lock in
localrepo.lock (compare with dirstate.write).

store.fncachestore overrides write() from basicstore and calls a new
write function on the fncache object, which writes all entries to the
fncache file if it's dirty.

store.fncache.add() now just marks itself as dirty if a new name is added.
2011-01-28 13:38:34 +01:00
Adrian Buehlmann
658ccc6bdb localrepo: acquire lock on stream_in 2011-01-28 13:34:07 +01:00
David Soria Parra
7547a71806 tags: do not merge bookmarks with tags
bookmarks are no tags, therefore they should not be returned as tags.
2011-02-11 19:44:17 +01:00
David Soria Parra
9a6f3a9ae7 context: add method to return all bookmarks pointing to a node 2011-02-11 19:36:15 +01:00
Matt Mackall
50f1b0a0aa bookmarks: merge suspect addchangegroup into core
This is marked with FIXME because it's not clear that it makes any sense.
2011-02-10 13:46:28 -06:00
Matt Mackall
fea21bd858 bookmarks: merge low-level push/pull support into core 2011-02-10 13:46:28 -06:00
Matt Mackall
20e7dee431 bookmarks: merge lookup into localrepo 2011-02-10 13:46:28 -06:00
Matt Mackall
ca3d079172 bookmarks: merge _findtags method into core 2011-02-10 13:46:28 -06:00
Matt Mackall
89896dbd54 bookmarks: merge invalidation into core 2011-02-10 13:46:27 -06:00
Matt Mackall
0dfef4c009 bookmarks: move commit action into core 2011-02-10 13:46:27 -06:00
Matt Mackall
77f373813e bookmarks: merge rollback support into localrepo 2011-02-10 13:46:27 -06:00
Matt Mackall
6e122bd621 bookmarks: move property methods into localrepo 2011-02-10 13:46:27 -06:00
Adrian Buehlmann
aef38e3838 remove pointless os.path.join calls when opening files in .hg/cache
Windows deals just fine with '/' in paths and Mercurial on Windows
already does file accesses elsewhere with mixed \ and / in file
paths anyway.

This patch also makes the static-http repo case use proper URLs of the
form

  http://example.com/repo/.hg/cache/branchheads
  http://example.com/repo/.hg/cache/tags

instead of the entirely pointless

  http://example.com/repo/.hg/cache%5Cbranchheads
  http://example.com/repo/.hg/cache%5tags

(as introduced by 5243ae377617)
2011-01-17 09:37:20 +01:00
Patrick Mezard
7700d1350b mq: factor out push conditions checks
Some extensions (e.g. hgsubversion) completely override push command. Because
extensions load order is unspecified, if hgsubversion loads before mq, mq
checks about not pushing applied patches will be bypassed. Short of finding a
way to fix load order, extracting the checking logic will allow
hgsubversion-like extensions to run the check themselves.
2011-01-31 22:16:33 +01:00
jfh
a52d7e5744 move tags.cache and branchheads.cache to a collected cache folder .hg/cache/
The generation of cache files like tags.cache and branchheads.cache is not an
actual reflection of things changing in the whole of the .hg directory (like eg
a commit or a rebase or something) but instead these cache files are just part
of bookkeeping. As such its convienant to allow various clients to ignore file
events to do with these cache files which would otherwise cause a double
refresh. Eg one refresh might occur after a commit, but the act of refreshing
after the commit would cause Mercurial to generate a new branchheads.cache which
would then cause a second refresh, for clients.

However if these cache files are moved into a directory like eg .hg/cache/ then
GUI clients on OSX (and possibly other platforms) can happily ignore file events
in this cache directory.
2011-01-04 06:29:08 +01:00
Benoit Boissinot
9d61e1d978 addchangegroup: document the current locking semantics 2011-01-16 17:26:34 +01:00
Matt Mackall
efaaee2894 revlog: remove lazy index 2011-01-04 14:12:52 -06:00
David Soria Parra
e107057815 avoid .split() in for loops and use tuples instead
split can be more readable for longer lists like the list in
dirstate.invalidate. As dirstate.invalidate is used in wlock() and therefoe
used heavily, I think it's worth avoiding a split there too.
2010-12-02 03:43:06 +01:00
Erik Zielke
d12bb06bf6 subrepo: backout 9f2d8e1439d7
backing out 9f2d8e1439d7 because it introduced a bug in
.hgsubstate handling.
2010-12-17 13:38:15 +01:00
Erik Zielke
19fa82cefe subrepo: avoids empty commit when .hgsubstate is dirty (issue2403)
This patch avoids empty commit when .hgsubstate is dirty. Empty commit
was caused by .hgsubstate being updated back to the state of the
working copy parent when committing, if a user had changed it manually
and not made any changes in subrepositories.

The subrepository state from the working copies parent is compared
with the state calculated as a result of trying to commit the
subrepositories. If the two states are the same, then return None
otherwise the commit is just done.

The line: "committing subrepository x" will be written if there is
nothing committed, but .hgsubstate is dirty for x subrepository.
2010-11-29 09:37:23 +01:00
Matt Mackall
fbcb895f80 merge with stable 2010-12-14 17:10:01 -06:00
Kevin Bullock
85d737621f tag: don't check .hgtags status if --local passed
Local tags don't create a commit, so we don't need to check the status
of .hgtags.
2010-12-13 21:20:30 -06:00
Matt Mackall
6d71ce3347 commit: search both parents for missing copy revision (issue2484)
raise a proper abort if we can't find an ancestor
2010-11-15 17:04:55 -06:00
Patrick Mezard
00e188f176 localrepo: do not modify ctx.remove() list in-place 2010-11-01 17:26:08 +01:00
Augie Fackler
11bc43400a bundle progress: offer best-guess deterministic progress information
This uses the same strategy as progress for pulls, estimating manifests
based on changeset count and estimating file count by files list in
each changeset.
2010-12-10 13:30:37 -06:00
Adrian Buehlmann
36da7599cc localrepo: remove unneeded os.unlink call in wwrite
The opener already unlinks the filename before 'w'riting, for both
the symlink and the normal file case. It also now resets the flags
for normal files on 'w'rite, which makes this os.unlink call completely
redundant.

For Windows, removing this extra unlink call helps to avoid tripping
issue2524 (os.unlink followed by a write).
2010-12-10 16:10:14 +01:00
Thomas Arendsen Hein
6fd4e6aaec coding style: fix gratuitous whitespace after Python keywords 2010-12-03 11:30:45 +01:00
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
a30b4f11ad localrepo: move string formatting out of gettext call 2010-11-24 13:25:12 +01:00
Matt Mackall
3fe296798a dirstate: warn on invalid parents rather than aborting
This allows more graceful recovery from some mangled dirstates
2010-11-22 12:43:31 -06:00
Matt Mackall
437f851e8f merge with stable 2010-11-15 17:05:54 -06:00
Ronny Pfannschmidt
83cb2b6070 localrepo: make heads use the keyword args of the sorted builtin 2010-11-02 11:25:52 +01:00
Kevin Bullock
15da3ac7f2 pull: silence spurious 'requesting all changes' message
When issuing `hg pull -r REV` in a repo with no common ancestor with the
remote repo, the message 'requesting all changes' is printed, even though only
the changese that are ancestors of REV are actually requested. This can be
confusing for users (see
http://www.selenic.com/pipermail/mercurial/2010-October/035508.html).

This silences the message if (and only if) the '-r' option was passed.
2010-10-20 17:38:21 -05:00
Mads Kiilerich
9c4dc8c331 subrepo: rename relpath to subrelpath and introduce reporelpath 2010-10-19 03:55:28 +02:00
Nicolas Dumazet
a926c48681 localrepo: use propertycaches to access encode/decode filters 2010-10-10 18:58:45 +02:00
Nicolas Dumazet
9d6722b6ec localrepo: load filter patterns outside of _filter 2010-10-10 19:10:16 +02:00
Nicolas Dumazet
90090e9482 localrepo: have _loadfilter return the loaded filter patterns 2010-10-10 19:07:58 +02:00
Adrian Buehlmann
04f7530508 store: encode first period or space in filenames (issue1713)
- Mac OS X has problems with filenames starting with '._'
  (e.g. '.FOO' -> '._f_o_o' is now encoded as '~2e_f_o_o')

- Explorer of Windows Vista and Windows 7 strip leading spaces of
  path elements of filenames when copying trees

Above problems are avoided by encoding the first space (as '~20') or
period (as '~2e') of all path elements.

This introduces a new entry 'dotencode' in .hg/requires, that is,
a new repository filename layout (inside .hg/store).

Newly created repositories require 'dotencode' by default. Specifying

  [format]
  dotencode = False

in a config file will use the old format instead.

Prior Mercurial versions will abort with the message

   abort: requirement 'dotencode' not supported!

when trying to access a local repository that requires 'dotencode'.

New 'dotencode' repositories can be converted to the previous
repository format with

  hg --config format.dotencode=0 clone --pull repoA repoB
2010-10-09 21:54:50 +02:00
Benoit Boissinot
657ba912ee changegroupsubset: use readdelta() fast path when delta is against a parent 2010-10-08 18:00:15 -05:00
Matt Mackall
c2f36f74bb bundle: encapsulate all bundle streams in unbundle class 2010-09-20 14:32:21 -05:00
Matt Mackall
4b4d939b00 bundle: get rid of chunkiter 2010-09-19 12:51:54 -05:00
Matt Mackall
1118760c78 bundle: refactor progress callback
This lets us eliminate the chunk iterator so we can have the bundle class
parse headers.
2010-09-19 12:38:44 -05:00
Matt Mackall
43940bec52 bundle: make getchunk() a method 2010-09-18 18:20:34 -05:00
Sune Foldager
aca3a53bf9 clone: only use stream when we understand the revlog format
This patch fixes issues with stream cloning in the presense of parentdelta,
lwcopy and similar additions that change the interpretation of the revlog
format, or the format itself.

Currently, the stream capability is sent like this:
stream=<version of changelog>

But the client doesn't actually check the version number; also, it only checks
the changelog and it doesn't capture the interpretation-changes and
flag-changes in parentdelta and lwcopy.

This patch removes the 'stream' capability whenever we use a non-basic revlog
format, to prevent old clients from receiving incorrect data. In those cases,
a new capability called 'streamreqs' is added instead. Instead of a revlog
version, it comes with a list of revlog-format relevant requirements, which
are a subset of the repository requirements, excluding things that are not
relevant for stream.

New clients use this to determine whether or not they can stream. Old clients
only look for the 'stream' capability, as always. New servers will still send
this when serving old repositories.
2010-09-15 11:06:22 +02:00