Commit Graph

1093 Commits

Author SHA1 Message Date
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
Sune Foldager
3d0e1080a1 fix errors reported by pyflakes test 2011-05-04 19:27:55 +02:00
Dan Villiom Podlaski Christiansen
511c941422 prevent transient leaks of file handle by using new helper functions
These leaks may occur in environments that don't employ a reference
counting GC, i.e. PyPy.

This implies:
 - changing opener(...).read() calls to opener.read(...)
 - changing opener(...).write() calls to opener.write(...)
 - changing open(...).read(...) to util.readfile(...)
 - changing open(...).write(...) to util.writefile(...)
2011-05-02 10:11:18 +02:00
Peter Arrenbrecht
5fbc4a50f1 localrepo: reuse parent manifest in commitctx if no files have changed
This speeds up the in-memory version of debugbuilddag that I'm
working on considerably for the case where we want to build just
a 00changelog.i (for discovery tests, for instance).

There are a couple of test changes because node ids in tests
have changed.

The changes to the patch names in test-mq-qdelete.t were required
because they could collide with nodeid abbreviations and newly
actually do (patch "c" collides with id "cafe..." for patch "b").
2011-05-02 19:20:29 +02:00
Mads Kiilerich
ec46d5bf4d backout a3900c75ca8c - the "unreachable code" was apparently not unreachable
All tests repeatedly passes with a3900c75ca8c on some machines, but on other
machines it regularly causes failure in test-mv-cp-st-diff.t, such as:

@@ -203,6 +203,7 @@

   - working to root: --rev 0
   M a
+  M x/x
   A b
     a
2011-05-01 19:51:28 +02:00
Sune Foldager
f3630ec41e merge with mpm 2011-05-01 19:44:28 +02:00
Benoit Boissinot
b805aced54 unbundler: separate delta and header parsing
Add header parsing for changelog and manifest (currently no headers might
change for next-gen bundle).
2011-04-30 19:01:24 +02:00
Brodie Rao
92f1644187 pushkey: add hooks for pushkey/listkeys 2011-05-01 11:12:36 +02:00
Brodie Rao
b7f0d2a103 url: move URL parsing functions into util to improve startup time
The introduction of the new URL parsing code has created a startup
time regression. This is mainly due to the use of url.hasscheme() in
the ui class. It ends up importing many libraries that the url module
requires.

This fix helps marginally, but if we can get rid of the urllib import
in the URL parser all together, startup time will go back to normal.

perfstartup time before the URL refactoring (707e4b1e8064):

! wall 0.050692 comb 0.000000 user 0.000000 sys 0.000000 (best of 100)

current startup time (9ad1dce9e7f4):

! wall 0.070685 comb 0.000000 user 0.000000 sys 0.000000 (best of 100)

after this change:

! wall 0.064667 comb 0.000000 user 0.000000 sys 0.000000 (best of 100)
2011-04-30 09:43:20 -07:00
Peter Arrenbrecht
b867e650e6 discovery: drop findoutgoing and simplify findcommonincoming's api
This is a long desired cleanup and paves the way for new discovery.
To specify subsets for bundling changes, all code should use the heads
of the desired subset ("heads") and the heads of the common subset
("common") to be excluded from the bundled set. These can be used
revlog.findmissing instead of revlog.nodesbetween.

This fixes an actual bug exposed by the change in test-bundle-r.t
where we try to bundle a changeset while specifying that said changeset
is to be assumed already present in the target. This used to still
bundle the changeset. It no longer does. This is similar to the bugs
fixed by the recent switch to heads/common for incoming/pull.
2011-04-30 17:21:37 +02:00
Alexander Solovyov
0eb3836642 remove unused imports and variables 2011-04-30 13:59:14 +02:00
Dan Villiom Podlaski Christiansen
a70a975a50 branchcache: improve speed relative to the amount of heads
Updating the branch cache is quadratic to the amount of heads in the
repository. One consequence of this was that cloning a pathological
repository with 10,000 heads (and nothing else) took hours of CPU
time.

This patch makes one of the inner loop much faster, by removing a
changectx instantiation, and removes another entirely in cases where
there are no candidate branch heads which descend from other branch
heads.
2011-04-30 12:56:28 +02:00
Peter Arrenbrecht
9855dca4f8 wireproto: add test for new optional arg missing on server
New argument is silently ignored by both HTTP and SSH servers.
This means we can, for instance, add new flags to getbundle()
to request advanced features (like lightweight-copy-aware bundles),
and older servers will silently ignore this request and send back
a plain bundle.
2011-04-29 14:54:01 +02:00
Adrian Buehlmann
7dd20c29b9 changegroup: do not count closed new heads (issue2697)
If a closed head gets pulled, we currently see (example):

  $ hg pull
  pulling from $TESTTMP/repo2
  searching for changes
  adding changesets
  adding manifests
  adding file changes
  added 2 changesets with 1 changes to 1 files (+1 heads)
  (run 'hg heads' to see heads, 'hg merge' to merge)

A subsequent 'hg heads' doesn't show that head because it is closed.

This patch improves the UI response texts for that same use case to:

  $ hg pull
  pulling from $TESTTMP/repo2
  searching for changes
  adding changesets
  adding manifests
  adding file changes
  added 2 changesets with 1 changes to 1 files
  (run 'hg update' to get a working copy)

That is, the part "(+1 heads)" is not shown in that case any longer.
2011-04-24 20:11:05 +02:00
Idan Kamara
762d333ae9 eliminate various naked except clauses 2011-04-23 00:51:25 +03:00
Adrian Buehlmann
307196b733 move path_auditor from util to scmutil 2011-04-20 22:43:31 +02:00
Adrian Buehlmann
cf126bb7dd move opener from util to scmutil 2011-04-20 19:54:57 +02:00
Martin Geisler
5a3f4fec03 merge with stable 2011-04-19 15:19:54 +02:00
Idan Kamara
22e5d8d701 localrepo: don't add deleted files to list of modified/added files (issue2761)
If a file is deleted (rm, not 'hg rm') from the working dir
an attempt to run 'hg diff -r X', with the file being present in X will
cause an abort.

We didn't check if the file has been deleted from the working dir
and later on tried to open it to compare with the one from X, causing the abort.

This fix adds that check. Consequently, no output will be returned.
2011-04-11 21:44:22 +03:00
Mads Kiilerich
8c1c7b8a31 status: remove unreachable code for status between revisions
The manifest value of a file will never be false when "not parentworking", and
the expensive content comparision would thus fortunately never be reached. (If
it was reached it would be wrong for example in case of renames.)

This code once handled status against working directory, but that has been done
elsewhere for a long time.
2011-02-24 14:06:08 +01:00
Idan Kamara
9fe3148843 tags: remove another check for valid nodes
see 3a1c93dc25b9
2011-04-07 17:16:17 +03:00
Idan Kamara
c341aeb03e localrepo: ignore tags to unknown nodes (issue2750) 2011-04-04 22:51:10 +03:00
Matt Mackall
a8dd64dcb0 misc: replace .parents()[0] with p1() 2011-04-04 16:21:59 -05:00
Idan Kamara
8b72616ae0 localrepo: tighten except clause when looking rev 2011-04-04 18:05:14 +03:00
Matt Mackall
1fb0b59ceb changegroup: introduce bundler objects
This makes the bundler pluggable at lower levels.
2011-03-31 15:24:06 -05:00
Matt Mackall
609353a898 changegroup: combine lookup functions 2011-03-31 14:25:26 -05:00
Matt Mackall
cd49a753c7 changegroup: unnest flookup 2011-03-31 13:56:05 -05:00
Brodie Rao
3a43fa887e url: refactor util.drop_scheme() and hg.localpath() into url.localpath()
This replaces util.drop_scheme() with url.localpath(), using url.url for
parsing instead of doing it on its own. The function is moved from
util to url to avoid an import cycle.

hg.localpath() is removed in favor of using url.localpath(). This
provides more consistent behavior between "hg clone" and other
commands.

To preserve backwards compatibility, URLs like bundle://../foo still
refer to ../foo, not /foo.

If a URL contains a scheme, percent-encoded entities are decoded. When
there's no scheme, all characters are left untouched.

Comparison of old and new behaviors:

URL                      drop_scheme()   hg.localpath()    url.localpath()
===                      =============   ==============    ===============
file://foo/foo           /foo            foo/foo           /foo
file://localhost:80/foo  /foo            localhost:80/foo  /foo
file://localhost:/foo    /foo            localhost:/foo    /foo
file://localhost/foo     /foo            /foo              /foo
file:///foo              /foo            /foo              /foo
file://foo               (empty string)  foo               /
file:/foo                /foo            /foo              /foo
file:foo                 foo             foo               foo
file:foo%23bar           foo%23bar       foo%23bar         foo#bar
foo%23bar                foo%23bar       foo%23bar         foo%23bar
/foo                     /foo            /foo              /foo

Windows-related paths on Windows:

URL                      drop_scheme()   hg.localpath()    url.localpath()
===                      =============   ==============    ===============
file:///C:/foo           C:/C:/foo       /C:/foo           C:/foo
file:///D:/foo           C:/D:/foo       /D:/foo           D:/foo
file://C:/foo            C:/foo          C:/foo            C:/foo
file://D:/foo            C:/foo          D:/foo            D:/foo
file:////foo/bar         //foo/bar       //foo/bar         //foo/bar
//foo/bar                //foo/bar       //foo/bar         //foo/bar
\\foo\bar                //foo/bar       //foo/bar         \\foo\bar

Windows-related paths on other platforms:

file:///C:/foo           C:/C:/foo       /C:/foo           C:/foo
file:///D:/foo           C:/D:/foo       /D:/foo           D:/foo
file://C:/foo            C:/foo          C:/foo            C:/foo
file://D:/foo            C:/foo          D:/foo            D:/foo
file:////foo/bar         //foo/bar       //foo/bar         //foo/bar
//foo/bar                //foo/bar       //foo/bar         //foo/bar
\\foo\bar                //foo/bar       //foo/bar         \\foo\bar

For more information about file:// URL handling, see:
http://www-archive.mozilla.org/quality/networking/testing/filetests.html

Related issues:

- issue1153: File URIs aren't handled correctly in windows

  This patch should preserve the fix implemented in
  5c92d05b064e. However, it goes a step further and "promotes"
  Windows-style drive letters from being interpreted as host names to
  being part of the path.

- issue2154: Cannot escape '#' in Mercurial URLs (#1172 in THG)

  The fragment is still interpreted as a revision or a branch, even in
  paths to bundles. However, when file: is used, percent-encoded
  entities are decoded, so file:test%23bundle.hg can refer to
  test#bundle.hg ond isk.
2011-03-30 20:03:05 -07:00
Matt Mackall
d1e21c741d changegroup: unnest some lookup functions 2011-03-31 10:03:24 -05:00
Matt Mackall
70a486fc7f changegroup: minor ordering and renaming changes for similarity
This eliminates some needless differences between the two changegroup variants
2011-03-31 09:59:56 -05:00
Matt Mackall
2cd8ddf3e1 changegroup: remove nodeiter temporary 2011-03-31 09:56:27 -05:00
Matt Mackall
6cf532f349 changegroup: refactor prune as a filter 2011-03-30 17:50:34 -05:00
Matt Mackall
b62691ff5f changegroup: add first logic to send file header
This will allow us to later change how we filter needed file nodes
2011-03-30 17:50:27 -05:00
David Soria Parra
c0e729f18b bookmarks: do not forward merged bookmark (issue1877) 2011-03-14 23:50:28 +01:00
Adrian Buehlmann
92624f7391 set NOT_CONTENT_INDEXED on .hg dir (issue2694)
when running on Windows
2011-03-28 15:54:22 +02:00
Matt Mackall
42728c501f changegroup: fold linkrev helper into lookup functions 2011-03-28 11:18:56 -05:00
Matt Mackall
c7c0df4b7e changegroup: fold filenode collector into mlookup 2011-03-28 11:18:56 -05:00
Matt Mackall
7dc3f0f9f2 changegroup: roll changegroup.collector into lookup functions 2011-03-28 11:18:56 -05:00
Matt Mackall
c9e7d5507f changegroup: add revlog to the group callback 2011-03-28 11:18:56 -05:00
Matt Mackall
d9e86660be changegroup: move sorting down into group 2011-03-28 11:18:56 -05:00
Matt Mackall
7fbf746bf2 changegroup: fold progress meter into callbacks
progress meters now start at 1 rather than 0
2011-03-28 11:18:56 -05:00
Matt Mackall
f94b6206a0 changegroup: combine infocollect and lookup callbacks 2011-03-28 11:18:56 -05: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
Sune Foldager
867cb5176e localrepo: factor out requirement application and write 2010-09-15 10:44:10 +02:00
Martin Geisler
c85f2356e3 subrepos: add function for iterating over ctx subrepos 2010-09-07 16:34:07 +02:00
Martin Geisler
5cb4b1f5eb subrepos: handle modified but uncommitted .hgsub 2010-09-07 16:23:55 +02:00
Martin Geisler
cb21fe1ac3 localrepo: check nested repos against working directory
This checks against what is really in the filesystem, including
subrepositories that have been added to .hgsub but not yet committed.
2010-09-07 15:31:56 +02:00
Martin Geisler
f2188b5b90 status: recurse into subrepositories with --subrepos/-S flag 2010-09-03 12:58:51 +02:00
Martin Geisler
bfa6c992eb localrepo: add auditor attribute which knows about subrepos 2010-09-03 12:58:51 +02:00
Martin Geisler
6a3762a95e commit: sort subrepos before committing for stable test output 2010-08-31 16:36:31 +02:00
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
Georg Brandl
5a08641165 localrepo: introduce method for explicit branch cache update
Currently, localrepo.branchtags() is called in two locations to update the
_branchcache dict, however branchtags() itself does not update anything, it
calls branchmap() to do so. This change introduces a new updatebranchcache()
method that is used by both branchmap() and the calls to update the cache.
2010-08-28 23:57:39 +02:00
Patrick Mezard
6603319ceb repository: drop unused rjoin() method
This method was introduced by b0e5c3bce42a but grepping the history does not
reveal any call. Extensions may use it but the method intent is not even clear
to me.
2010-08-22 13:17:34 +02:00
Pradeepkumar Gayam
e2c89f7a97 localrepo: add parentdelta to requires only if enabled in config file 2010-08-10 22:28:08 +05:30
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
055002dd11 localrepo: refactor filter computation
Separate loading part from access part to be able to tell with:
  repo._loadfilter(name)
  bool(name in repo.filterpats)
if there is a 'name' filter available.
2010-07-24 00:28:20 +09:00
Nicolas Dumazet
02750015e0 localrepo.status: move fixup concatenation inside if block for clarity
clean += fixup only makes sense if fixup is not empty; it should
be inside the "if fixup" test.
2010-07-25 10:05:38 +09:00
Benoit Boissinot
68e9051490 changegroup*(): use enumerate when possible 2010-07-24 00:15:29 +02:00
Benoit Boissinot
e8a7ae7259 changegroupsubset(): with the fix, prune() is actually useful in the testsuite 2010-07-24 00:03:19 +02:00
Benoit Boissinot
fc9a4ead97 changegroupsubset: simplify knownheads/has_cl_set computation 2010-07-23 00:04:18 +02:00
Benoit Boissinot
3914cfbfcd changegroupsubset(): ancestors() is not inclusive, we need to remove the "heads" 2010-07-22 23:54:57 +02:00
Benoit Boissinot
6fc1d6e96b changegroupsubset(): move comment at the right place 2010-07-22 23:44:14 +02:00
Benoit Boissinot
fec5f7c3d8 changegroupsubset(): refactor the prune() functions 2010-07-22 23:13:03 +02:00
Peter Arrenbrecht
8f2d068a05 discovery: avoid discovery when local graph is a subset of remote
Immediately sends local's heads to the server to check whether the server knows them all.
If it does, we can call getbundle immediately.

Interesting test output changes are:

-  added 1 changesets with 0 changes to 1 files (+1 heads)
+  added 1 changesets with 0 changes to 0 files (+1 heads)

-> The new getbundle() actually fixes a bug vs. changegroupsubset() in that it no longer
returns unnecessary files when file revs are reused.

warning: repository is unrelated
+  requesting all changes

-> The new use of common instead of bases correctly indicates that an unrelated pull
gets all changes from the server.
2011-03-23 16:06:55 +01:00
Peter Arrenbrecht
6646f48826 wireproto: add getbundle() function
getbundle(common, heads) -> bundle

Returns the changegroup for all ancestors of heads which are not ancestors of common. For both
sets, the heads are included in the set.

Intended to eventually supercede changegroupsubset and changegroup. Uses heads of common region
to exclude unwanted changesets instead of bases of desired region, which is more useful and
easier to implement.

Designed to be extensible with new optional arguments (which will have to be guarded by
corresponding capabilities).
2011-03-23 16:02:11 +01:00
Peter Arrenbrecht
d542bac8c7 wireproto: add known([id]) function
known([Node]) -> [1/0]

Returns 1/0 for each node, indicating whether it's known by the server.
Needed for new discovery protocols introduced in later patches.
2011-03-22 09:22:21 +01:00
Peter Arrenbrecht
375ab88b9f debug: add debugwireargs to test argument passing over the wire
Tests argument passing locally, via HTTP, and via SSH. This is mainly preparation
for the next patch.
2011-03-22 07:38:32 +01:00
Matt Mackall
8a1d106a60 changegroup: minor cleanups 2011-03-20 20:25:41 -05:00
Matt Mackall
5468a6deab changegroup: fix leftover from delta read 2011-03-20 20:17:57 -05:00
Matt Mackall
6c9dcf752e changegroup: drop expensive redundant usage of readdelta for progress 2011-03-20 20:16:51 -05:00
Matt Mackall
d4b4c17c11 changegroupsubset: use manifest.readfast to simplify collector 2011-03-20 19:43:28 -05:00
Matt Mackall
3e746ce14e changegroupsubset: simplify filenode_collector 2011-03-20 19:43:28 -05:00
Matt Mackall
91e167ab79 changegroupsubset: more renaming 2011-03-20 19:43:28 -05:00
Matt Mackall
bd3182c8ff changegroupsubset: simplify prune
Ancestors of nodes linked to commonrevs can be expected to be linked
to commonrevs. Walking graphs of each revlog looking for rare/nonexistent outliers is overkill.
2011-03-20 19:43:28 -05:00
Matt Mackall
f97f8563d2 changegroupsubset: more minor cleanups
- remove more excessive comments
 - simplify some sorting operations
 - rename some variables
 - replace identity with a lambda
2011-03-20 19:43:28 -05:00
Matt Mackall
4e33ba22d8 changegroupsubset: minor cleanups
- move some variable declarations
 - drop some excessive comments
 - use standard variable naming
2011-03-20 19:43:28 -05:00
Benoit Boissinot
5d27fc0ccb changegroupsubset: extranodes are no longer needed 2011-03-20 01:16:57 +01:00
David Soria Parra
848c5155b1 localrepo: do not update bookmarks in addchangegroup
We want to update the current bookmark to the most recent revision on
current branch unless there is a remote bookmark that points to
a different descendant. Addchangegroup is called before we can check for
remote bookmarks.

We don't update the bookmark in addchangegroup anymore to allow proper updating
of bookmarks in pull.
2011-03-14 20:53:55 +01:00
David Soria Parra
4e5087c547 bookmarks: separate bookmarks update code from localrepo's pull.
We explicitly want to update bookmarks from a remote. This will avoid
duplicate calls to listkeys if we clone (which calls pull) and keep
bookmark related code together.
2011-03-14 00:10:43 +01:00
Benoit Boissinot
c7e7cca544 changegroupsubset(): change variable names, simplify lookup logic 2010-07-22 16:51:45 +02:00
Benoit Boissinot
d2d26a535b changegroup(): used "linkrev" instead of "revlink" 2010-07-22 16:18:33 +02:00
Benoit Boissinot
1c069d50bd fix comment 2010-07-22 15:32:26 +02:00
Benoit Boissinot
27026ab37f changegroup*(): use set instead of dict 2010-07-22 14:34:37 +02:00
Nicolas Dumazet
517eb64655 merge with stable 2010-07-22 15:14:22 +09:00
Mads Kiilerich
f9b5838b6f init: create target directory recursively
Subrepos with relative paths must often be cloned to locations deep in the
directory structure. This allows clone over ssh (init+push) work.
2010-07-21 19:29:57 +02:00
Benoit Boissinot
8e7a94f166 changegroupsubset: remove unneeded cast to list 2010-07-16 18:35:15 +02:00
Benoit Boissinot
b4d92505c7 localrepo: remove push_{unbundle,addchangegroup}(), factor it inside push() 2010-07-16 13:38:33 +02:00
Matt Mackall
5e9649ad3b commit: add missing _() 2010-07-01 11:22:56 -05:00
Matt Mackall
5e2b0ca2ab subrepo: refuse to commit subrepos if .hgsub is excluded (issue2232) 2010-07-01 11:20:13 -05:00
Matt Mackall
e4cf775b71 addchangegroup: pass in lock to release it before changegroup hook is called
Currently, callers of addchangegroup first acquire the repository
lock, usually to check that an unbundle request isn't racing. This
means that changegroup hook actions that might write to a repo get
stuck waiting for a lock. Here, we add a new optional lock parameter
and update all the callers. Post-1.6 we may make it non-optional.
2010-06-25 13:47:28 -05:00
Matt Mackall
ae48625c19 pushkey: add localrepo support 2010-06-16 16:04:46 -05:00
Dirkjan Ochtman
af6b696f0f move working dir/dirstate methods from localrepo to workingctx 2010-06-07 20:03:32 +02:00
Dirkjan Ochtman
cf1de649bd move discovery methods from localrepo into new discovery module 2010-06-07 18:35:54 +02:00
Ronny Pfannschmidt
4362059a98 make transactions work on non-refcounted python implementations 2010-05-27 17:47:40 +02:00
Matt Mackall
e9152b864c Merge with stable 2010-05-28 16:01:57 -05:00
Matt Mackall
26c38ffe0e status: avoid performance regression when no .hgsub is present
(introduced by 3067d5de9e6c)
2010-05-28 14:41:11 -05:00
Sune Foldager
f9f5488566 push: add --new-branch option to allow intial push of new branches
Compare this to --force which allows anything to be pushed. With --new-branch,
only changesets to named branches not present on the and changesets not
introducing additional heads on existing branches are allowed.

Developed by
  Henrik Stuart <henrik.stuart@edlund.dk>
  Sune Foldager <cryo@cyanite.org>
2010-05-21 15:22:29 +02:00
Matt Mackall
a02b5a5fd1 commands: initial audit of exit codes
bisect: clarify None return
bundle: return 1 on no changes
clone: return result code
copy: limit errors to 0/1
commit: return 1 on no changes
forget: return 1 on errors
grep: return 1 if no match found
remove: return 1 on errors
resolve: return 1 if something fails to resolve
rollback: return 1 if no rollback data
2010-05-15 17:48:49 -05:00
Matt Mackall
3d7e1368a3 rollback: fix off-by-one in message 2010-05-13 17:36:45 -05:00
Matt Mackall
eb7971b34e Merge with stable 2010-05-11 17:03:44 -05:00
Greg Ward
89bd117131 push: document return values between various repo methods.
This starts at localrepository.push() and seeps down to
push_addchangegroup(), push_unbundle(), prepush(), addchangegroup(),
and leaks out to sshrepository.unbundle(), sshrepository.addchangegroup(),
and httprepository.unbundle().  Seems to cover everything you ever
wanted to know about pushing but were afraid to ask.
2010-05-02 21:56:25 -04:00
Edouard Gomez
293b104156 subrepo: print paths relative to upper repo root for push/pull/commit
This makes more sense when using multiple levels of
nesting.

This happens to help a lot in a case where 3 projects
of mine all use the same makefile helper project as a
sub. A fourth project use these first three projects
and current output made it very hard to figure
which makefile helper was committed. it looked more
like the project was committed/pushed/pulled three times
in a row than dealing on three different repos.
2010-05-01 23:05:22 +02:00
Nicolas Dumazet
22fdcb45f3 tag: warn users about tag/branch possible name conflicts
As reported recently, Mercurial users can easily find confusion when
using a common name for a tag and a branch. It seems reasonable to warn
them about this potential outcome, to avoid that "surprise".
* Explain briefly the issue in "hg help tag"
* Warn when tagging a revision
2010-04-19 17:41:12 +09:00
Eric Eisner
dd5c303d3f tags: return tags in sorted order
This makes log and summary have less arbitrary tag ordering and also
groups similar tags together, such as the mq tags.
2010-04-26 15:58:36 -04:00
Benoit Boissinot
5fb4657cce localrepo.commit: use explicit variables, avoid creating new contexts 2010-04-21 01:34:12 +02: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
Steve Losh
8551e0d0f2 commands: add more robust support for 'hg log -b' (issue2078)
Fixes issue2078 and adds tests to cover various 'hg log -b' uses.

This change adds a localrepo.lookupbranch(key, remote=None) function. This
will look up the branch of the revision with the given key. The algorithm
works like this:

    * If a remote repo is given and KEY is the name of a branch in that repo,
      return KEY.
    * If no remote repo is given and KEY is the name of a branch in the local
      repo object, return KEY.
    * Otherwise look up the revision with the identifier KEY in the local repo
      and return its branch.

This change also makes 'hg log -b' use this new functionality and adds a few
tests for it.
2010-04-12 19:33:25 -04:00
Sune Foldager
3a5dc74781 merge with stable 2010-04-15 22:34:26 +02:00
Sune Foldager
a81e6a76a5 prepush: rewrite most of the code from scratch
For servers with branchmap support, the algorithm now works as follows:

1. A list of branches in outgoing changesets is created.
2. Using the remote branchmap, a check for new branches is performed.
3. A map (from branch to head list) of locally known remote heads before
   the push is created, and one which, after step 4, will contain the locally
   known remote heads after the push.
4. The post-push head map is updated with the outgoing changesets, using the
   branch cache update mechanism.
5. A check for new heads is performed, by comparing the length of the head list
   before and after push, for each branch. If there are new heads, an error
   depending on whether or not there are incoming changes on the branch,
   is returned.
6. If the push is allowed, a warning is written if there are incoming changes
   on any branches involved in the push.

For old servers, an algorithm similar to step 4-6 above is used to check for
new topological heads only.

Two bugs are also fixed:
1. Sometimes you would be allowed to push new branch heads without --force.
   A test for this case was added.
2. You would get the "note: unsynced remote changes!" warning if there were any
   incoming changesets, even if they were on unrelated branches.
2010-04-15 21:59:21 +02:00
Sune Foldager
fac215850a localrepo: simplify _updatebranchcache slightly 2010-04-15 17:25:37 +02:00
Sune Foldager
f2631c6182 merge with stable 2010-04-14 19:49:06 +02:00
Sune Foldager
c7f5c787cc merge 2010-04-14 19:43:40 +02:00
Sune Foldager
0fd6b63c90 prepush: backed out refactoring
It has some problems in corner cases and will fail on a test recently
introduced on stable. Will maybe be reintroduced later, in a better
version.
2010-04-14 19:43:19 +02:00
Sune Foldager
62eb1177d6 prepush: fix bug in warning message selection
In certain situations you would be told "you should pull and merge" even when
there is nothing to pull.
2010-04-14 19:11:35 +02:00
Matt Mackall
32c96f5420 rollback: improve message 2010-04-12 17:21:30 -07:00
Matt Mackall
1e8a0f7c37 transaction: use newlines to separate description elements 2010-04-12 17:11:14 -07:00
Matt Mackall
4fff9367de progress: show approximate progress info for pull 2010-04-10 17:20:43 -05:00
Patrick Mezard
ec416a501a localrepo: do not store URL password in undo.desc 2010-04-12 21:37:21 +02:00
Steve Borho
8299cbf24b rollback: add dry-run argument, emit transaction description 2010-04-09 17:23:37 -05:00
Steve Borho
c7ec998a7b localrepo: add desc parameter to transaction
All callers to localrepo.transaction() must supply a transaction description.
The description and the existing repository tip are then stored
(transactionally) into .hg/undo.desc; where rollback can later find it.
2010-04-09 17:23:35 -05:00
Sune Foldager
b66624019c partial backout of 5a81f112887e and add tests (issue2131)
The tests are due to Peter Arrenbrecht
2010-04-08 19:46:47 +02:00
Peter Arrenbrecht
3ae78ab394 localrepo: refactor prepush logic
Simplifies the prepush check logic and makes it a lot more direct and
comprehensible. Instead of comparing the total local vs. remote head count, it
compares the number of new vs. removed heads.
2010-04-08 17:21:42 +02:00
Sune Foldager
bd6af17a91 merge with stable 2010-04-09 10:35:53 +02:00
Benoit Boissinot
3cebbf4916 merge with stable 2010-04-06 00:46:09 +02:00
Benoit Boissinot
679db973ed clone: no race possible, we can use changegroup() and have smaller urls
Related to issue2126
2010-04-06 00:45:53 +02:00
Sune Foldager
8d7f484a9b merge with stable 2010-03-26 17:09:56 +01:00
Sune Foldager
cd0e8d7662 push: refactor and optimize prepush 2010-03-26 17:02:49 +01:00
Sune Foldager
7acd5cb299 push: fix bug in prepush logic and its tests 2010-03-26 17:02:36 +01:00
Sune Foldager
7c4049acf8 localrepo: change _updatebranchcache to use a context generator 2010-03-26 17:02:23 +01:00
Martin Geisler
792e753cbc localrepo: more specific warning on adding large files
With better language as suggested by timeless.
2010-03-18 01:58:26 +01:00
Martin Geisler
9437379d1f Merge with stable 2010-03-18 01:59:53 +01:00
Matt Mackall
6e515e4e5d progress: drop extra args for pos=None calls (issue2087) 2010-03-17 18:15:16 -05:00
Martin Geisler
f3b2ed5d56 progress: use a verb (+noun) in present participle 2010-03-15 18:33:39 +01:00
Martin Geisler
7dc53bec4e Merge with stable 2010-03-15 18:36:11 +01:00
Benoit Boissinot
3db7df2869 style: use consistent variable names (*mod) with imports which would shadow 2010-03-11 17:43:44 +01:00
Benoit Boissinot
c967347014 strip: invalidate all caches after stripping (fixes issue1951)
test thanks to Stefano Tortarolo
2010-02-21 20:59:27 +01:00
Saint Germain
a779bc7bd1 subrepo: Update .hgsubstate in case of deleted subrepo
When a subrepo is deleted from .hgsub, it also needs to be removed from
.hgsubstate. Previous code was updating .hgsubstate only in case of newly or
modified subrepo.
2010-02-22 01:19:59 +01:00
Martin Geisler
355bb1daf3 progress: mark units for translation 2010-02-20 20:08:42 +01:00
Benoit Boissinot
7dae5be27b i18n: mark more strings for translation 2010-02-19 02:23:38 +01:00
Martin Geisler
e2e1279b27 progress: mark strings for translation 2010-02-17 23:07:50 +01:00
Sune Foldager
2369132b4b run commit and update hooks after command completion (issue1827)
Previously, the working dir state hadn't been written when these
hooks were invoked, so external commands couldn't see all changes.
2010-02-17 15:43:21 +01:00
Alexander Solovyov
f11ee5abee expand paths to local repository or bundle in appropriate classes
This avoids problem with unexpanded paths when it's not possible to
expand it at higher level (for example, if file:~/path/ is supplied as
path in schemes).
2009-12-07 12:31:45 +02:00
Matt Mackall
3b7a5c7ec1 progress: add progress calls to changeset discovery 2010-02-13 00:38:29 -06:00
Augie Fackler
123811715e localrepo: provide indeterminate progress information while bundling 2010-02-09 10:02:01 -06:00
Augie Fackler
47c5689cb6 localrepo: show indeterminate progress for incoming data
This has some quirks, like showing progress bars for importing
bundles, including during rebase.
2010-02-07 12:00:40 -06:00
Patrick Mezard
288790327a Merge with crew-stable 2010-02-13 02:06:13 +01:00
Giorgos Keramidas
a74504962c convert: differentiate between IOError and OSError on commitctx()
The IOError exception is overloaded to mean 'this file was deleted in
the current commit'.  Separate the code that handles IOError and file
deletion from general OSError exceptions.  The latter are real errors,
but IOError is not always a throwable error.

This solves the accidental marking of files as 'deleted' in commits that
try to write for example in .hg/store/data revlogs that the current user
has no permission to modify (a normal OSError that should abort the
current commit).

Changed by pmezard: use getattr() to be on the safe side.
2010-02-11 23:15:42 +02:00
Augie Fackler
2b4b265287 localrepo: add optional validation (defaults to off) for incoming changes
This verifies that all manifests are present for incoming changes,
and all files for those manifests are also present. This is a simple
first-pass, and could be better, but seems like a valuable thing to
have, as I've seen pushes in the past that propagated revlog corruption.
2010-02-11 16:37:43 -06:00
Peter Arrenbrecht
659da7174a whitespace cleanup 2010-02-08 20:51:23 +01:00
Benoit Boissinot
c8ed050aba prepush: add more precise error messages
Part of the patch is from timeless@mozdev.org

- indicate the branch name where there are multiple heads
- give better advice when hitting a possible race, where new heads are added
  between discovery and the call to branchmap(). In that case, asking the user
  to merge isn't helpful, since only remote has the changes.
2010-02-08 19:44:04 +01:00
Benoit Boissinot
fc2478db7d localrepo: cleanup branch tip computation 2010-02-08 14:52:28 +01:00
Matt Mackall
595d66f424 Update license to GPLv2+ 2010-01-19 22:20:08 -06:00
Sune Foldager
9318efef10 fix bug in prepush logic involving merge changesets
When creating new branches and merging them into existing ones, you would
sometimes be able to push some changesets (the existing branches) without using
--force, even when that creates a new head on the remote.

A test which triggers the error has been added.
2009-11-30 14:58:52 +01:00
Dirkjan Ochtman
a0b7a8db3f strip apostrophes from an error messages 2010-02-07 15:09:02 +01:00
Peter Arrenbrecht
6a8e51ae73 bundle: don't send too many changesets (Issue1704)
The fast path in changegroupsubset can send too many csets. This happens
because it uses the parents of all bases as common nodes and then goes
forward from this again. If a base has a parent that has another child,
which is -not- a base, then this other child will nevertheless end up in
the changegroup.

The fix is to not use findmissing(), but use nodesbetween() instead, as
do the slow path and incoming/outgoing.

The change to test-notify.out is correct, because it actually hits this
bug, as can be seen by glog'ing the two repos:

@    22c88
|\
| o  0a184
| |
o |  0647d
|/
o  cb9a9

and

o  0647d
|
@  cb9a9

It used to pull 0647d again, which is unnecessary.
2009-11-07 12:28:30 +01:00
Sune Foldager
88f8c97e4b change 'journal already exists' to 'abandoned transaction found'
Journal already exists is a pretty internal piece of information, which
doesn't necessarily mean much to people who are not familiar with the code.
The new text is a more well-known concept.
2009-11-02 10:17:20 +01:00
Benoit Boissinot
77d119c7c3 localrepo/branchcache: remove lbranchmap(), convert users to use utf-8 names
We don't need a "local-charset" aware branchmap() function, we can convert the
names when needed during the output.
2009-10-31 00:31:08 +01:00
Benoit Boissinot
724ff6d9b3 localrepo/branchcache: kill unused localrepo.branchcache
The UTF-8 version of the branchcache is the master, always up-to-date, we can
rename it to localrepo._branchcache.
2009-10-31 00:27:50 +01:00
Benoit Boissinot
55d087a0fc localrepo/branchcache: rebuild the "charset-aware" branchcache when needed
It's simpler and the two cache weren't always in sync otherwise:
localrepo.branchcache would not be updated after calling branchmap()
2009-10-31 00:20:28 +01:00
Henrik Stuart
8e476f8bf5 transfer branchmap branch names over the wire in utf-8 2009-10-26 13:37:39 +01:00
Martin Geisler
42c594dc7e Merge with crew-stable 2009-09-27 09:38:53 +02:00
Sune Foldager
30958eab97 push: fix subtle bug in prepush logic
A test case demonstrating the bug has been added.
Contributed by Henrik Stuart and Sune Foldager.
2009-09-23 18:56:09 +02:00
Dirkjan Ochtman
a023094f1f merge with crew-stable 2009-09-23 15:54:43 +02:00
Sune Foldager
362c2022cc localrepo: fix bugs in branchheads and add docstring
- The call to reverse() reversed the list in place in the global branchmap.
- The nodesbetween function doesn't preserve ordering.
2009-09-23 15:51:36 +02:00
Martin Geisler
9f1896c083 do not attempt to translate ui.debug output 2009-09-19 01:15:38 +02:00
Greg Ward
d0559b076a Improve some docstrings relating to changegroups and prepush(). 2009-09-08 17:58:59 -04:00
Martin Geisler
235f78e4fb Merge with crew-stable 2009-09-04 23:34:51 +02:00
Matt Mackall
c34b180a9c Make distinct lookup error for localrepo.lookup
This allows clone/share to correctly distinguish lookup errors from
corruption errors and catch only the former.
2009-08-31 10:58:33 -05:00
Henrik Stuart
180b39fb48 branch heads: optimise computation of branch head cache (issue1734)
The previous branch heads cache implementation iterated all ancestors
for each new revision in the repository, causing a massive slowdown on
cloning larger repositories.
2009-07-13 20:19:17 +02:00
Henrik Stuart
a44e9f8977 branch heads: fix regression introduced in 084c96645721 (issue1726)
For merge nodes it is not adequate to only check a single possible
branch head for whether it is an ancestor of the latest head, but it
needs to be done for each possible branch head.
2009-07-09 20:49:02 +02:00
Matt Mackall
fc2733b540 commit: lose some pointless 'nothing changed' messages
Move message from localrepo to commands. This drops confusing messages
in subrepo, import, and rebase.
2009-07-01 01:16:19 -05:00
Matt Mackall
540c02c8d3 commit: report modified subrepos in commit editor 2009-07-01 01:05:24 -05:00
Greg Ward
80075c97bf localrepo: document the locking scheme a little better
- localrepo: document lock(), wlock() methods
- lock: add class docstring
2009-08-05 14:42:57 +02:00
Greg Ward
da8b780a58 tags: support 'instant' tag retrieval (issue548)
- modify _readtagcache() and _writetagcache() to read/write tag->node
  mapping for global tags
- if (and only if) tip unchanged, use that cached mapping to avoid
  reading any revisions of .hgtags
- change so tag names are UTF-8 in memory in tags.py, and converted to
  local encoding as late as possible (in localrepository._findtags())
2009-07-16 10:41:19 -04:00
Greg Ward
81e6782a86 tags: implement persistent tag caching (issue548).
- rename findglobaltags() to findglobaltags1() (so the "no cache"
  implementation is still there if we need it)
- add findglobaltags2() and make findglobaltags() an alias for it
  (disabling tag caching is a one-line patch)
- factor out tagcache class with methods readcache() and writecache();
  the expensive part of tag finding (iterate over heads and find
  .hgtags filenode) is now in tagcache.readcache()
2009-07-16 10:39:42 -04:00
Greg Ward
0487eef6d6 localrepo: add destroyed() method for strip/rollback to use (issue548). 2009-07-16 10:39:41 -04:00
Greg Ward
5aa64bf085 Factor tags module out of localrepo (issue548).
Currently only handles reading tags, and will soon grow support for
tag caching.  Could eventually deal with updating tags too.
2009-07-16 10:39:41 -04:00
Greg Ward
0a46ad48e3 localrepo: factor updatetags() out of readtags() (issue548). 2009-07-16 10:39:41 -04:00
Greg Ward
310d950984 localrepo: improve readability of _findtags(), readtags() (issue548).
- rename many local variables
- add some comments
- refactor call to line.split() (catch ValueError rather
  than checking length of return value: one less local variable)
2009-07-16 10:39:41 -04:00
Greg Ward
37b1525e95 localrepo: rename in-memory tag cache instance attributes (issue548).
- self.tagscache to self._tags
- self._tagstypecache to self._tagtypes
- this is for consistency, readability, privacy, and to subtly hint
  that "caching" is something else
2009-07-16 10:39:41 -04:00
Greg Ward
b0c72fe36d localrepo: factor _findtags() out of tags() (issue548).
This makes in-memory caching the sole responsibility of localrepo,
eliminating some localrepo code that was duplicated in mq and
bookmarks.
2009-07-16 10:39:41 -04:00
Martin Geisler
bfee32e919 merge with crew-stable 2009-07-14 20:10:23 +02:00
Matt Mackall
eb6cba34d7 Merge with stable 2009-07-09 19:49:02 -05:00
Martin Geisler
a8dfb6533c localrepo: removed unnecessary revkey sort helper 2009-07-05 12:43:40 +02:00
Alejandro Santos
1ef2fb42a7 compat: use 'key' argument instead of 'cmp' when sorting a list 2009-07-05 11:02:00 +02:00
Brendan Cully
e55703261f Branch heads should not include "heads" that are ancestors of other heads.
For example, given 1 (branch a) -> 2 (branch b) -> 3 (branch a)
I expect "hg heads a" to show only 3.
Discovered by running hg heads HEAD on the mutt repo, where older clients
committed default on top of HEAD.
2009-06-29 00:54:23 -07:00
Martin Geisler
16155b528f merged with crew 2009-06-21 19:06:57 +02:00
Matt Mackall
689cdd2284 tags: silence warning about unknown tags
This is mostly a nuisance and can happen legitimately with pull -r, etc.
2009-06-20 10:53:47 -05:00
Dongsheng Song
4e62c61983 Fix warning: Seen unexpected token "%" 2009-06-19 14:28:29 +08:00
Matt Mackall
0524b599b7 tags: drop nested function 2009-06-18 23:08:33 -05:00
Matt Mackall
2d1077e9a8 tags: generate contexts directly 2009-06-18 23:04:54 -05:00
Matt Mackall
caca0c5d48 tags: reverse and simplify head-walking 2009-06-18 20:50:35 -05:00
Matt Mackall
536867428a tags: simplify rev handling 2009-06-18 20:50:33 -05:00
Matt Mackall
45eb44ee7b tags: fold in _hgtagsnodes 2009-06-18 20:49:50 -05:00
Matt Mackall
fd08adf4d6 commit: recurse into subrepositories 2009-06-15 02:45:38 -05:00
Matt Mackall
66b213eda6 repo: add internal support for sharing store directories
set .hg/sharedpath to point to the .hg to share with
2009-06-13 18:01:46 -05:00
Matt Mackall
da6d619643 repo: set up ui and extensions earlier 2009-06-13 14:44:59 -05:00
John Mulligan
8806103077 localrepo: remove 'closed' argument to heads(...) function
- repository heads are not associated with the closed attribute, so
remove it making the code in line with the concept.
- Fix functions that were calling heads with the parameter.
- Adjust webcommands.branches to include the concept of inactive
as well as open and closed branches
- Fix code and docstrings in commands to make the correct use of
closed branches & branch heads clearer
- Improve grammar of 'hg heads' help text (2nd submission)

this does not alter the cli for hg branches, that work is
still to be done
2009-06-10 19:11:49 -04:00
Henri Wiechers
4269cb82b8 cleanup: removed unused imports 2009-06-07 21:16:05 +02:00
Matt Mackall
5ae9b1fb50 commit: move some setup outside the lock 2009-06-04 16:21:03 -05:00
Matt Mackall
243b33c531 commit: rename wctx to cctx 2009-06-03 17:12:48 -05:00
Matt Mackall
8b6f125b5e commit: trade O(n^2) file checks for O(n^2) dir checks 2009-06-01 22:13:08 -05:00
Matt Mackall
fcb44e87db commit: move explicit file checking into repo.commit 2009-06-01 21:51:00 -05:00
Matt Mackall
7c83f8b030 commit: editor reads file lists from provided context 2009-06-01 14:51:47 -05:00
Matt Mackall
c1213eaf9d commit: drop the now-unused files parameter 2009-06-01 14:11:32 -05:00
Matt Mackall
914f8e938d tag: use match.exact for commit 2009-06-01 14:11:19 -05:00
Matt Mackall
c22dd49465 commit: apply force flag without files 2009-06-01 13:51:21 -05:00
John Mulligan
e094244749 localrepo: set heads and branchheads to be closed=False by default
The heads(...) and branchheads(...) functions will now only return closed
heads when explicitly asked for them. This will cause 'hg merge' to have
better behavior in the presence of a branch that has closed heads when no
explicit rev is passed.
2009-06-03 13:42:55 +02:00
Matt Mackall
37eaadf540 match: ignore return of match.bad
All users returned false, return can now be dropped
2009-05-31 17:54:18 -05:00
Martin Geisler
3f7c86dc69 wrap string literals in error messages 2009-05-31 01:30:16 +02:00
Adrian Buehlmann
7a0533d1fa localrepo: move comment 2009-05-28 08:29:40 +02:00
Simon Heimberg
1d6b2ca034 localrepo: use lock.release for single lock 2009-05-27 14:16:13 +02:00
Matt Mackall
1c30179455 lookup: check for dirstate damage on failure 2009-05-25 10:44:37 -05:00
Matt Mackall
89c18ad8ce match: add some default args 2009-05-24 02:56:14 -05:00
Matt Mackall
532c58d931 match: change all users of util.matcher to match.match 2009-05-24 02:56:14 -05:00
Sune Foldager
2161b139a6 named branches: improve pre-push logic (issue736)
Each named branch is considered separately, and the push is allowed if
no new branch heads are created for any named branch to be pushed.

Due to some tests's use of --debug, their output will change after this
addition. This has been fixed as well.

Co-contributor: Henrik Stuart <henrik.stuart@edlund.dk>
2009-05-23 17:04:31 +02:00
Henrik Stuart
e3379206dc named branches: server branchmap wire protocol support (issue736)
The repository command, 'branchmap', returns a dictionary, branchname
-> [branchheads], and will be implemented for localrepo, httprepo and
sshrepo.

The following wire format is used for returning data:

branchname1 branch1head2 branch1head2 ...
branchname2 ...
...

Branch names are URL encoded to escape white space, and branch heads
are sent as hex encoded node ids. All branches and all their heads are
sent.

The background and motivation for this command is the desire for a
richer named branch semantics when pushing changesets. The details are
explained in the original proposal which is included below.


1. BACKGROUND

The algorithm currently implemented in Mercurial only considers the
graph theoretical heads when determining whether new heads are
created, rather than using the branch heads as a count (the algorithm
considers a branch head effectively closed when it is merged into
another branch or a new named branch is started from that point
onward).

Our particular problem with the algorithm is that we'd like to see the
following case working without forcing a push:

Upsteam has:

(0:dev) ---- (1:dev)
\
 `--- (2:stable)

Someone merges stable into dev:

(0:dev) ---- (1:dev) ------(3:dev)
\                         /
 `--- (2:stable) --------´

This can be pushed without --force (as it should).
Now someone else does some coding on stable (a bug fix, say):

(0:dev) ---- (1:dev) ------(3:dev)
\                          /
 `--- (2:stable) ---------´---------(4:stable)

This time we need --force to push.

We allow this to be pushed without using --force by getting all the
remote branch heads (by extending the wire protocol with a new
function).

We would, furthermore, also prefer if it is impossible to push a new
branch without --force (or a later --newbranch option so --force isn't
shoe-horned into too many disparate functions, if need be), except of
course in the case where the remote repository is empty.

This is what our patches accomplish.


2. ALTERNATIVES

We have, of course, considered some alternatives to reconstructing
enough information to decide whether we are creating new remote branch
heads, before we added the new wire protocol command.

2.1. LOOKUP ON REMOTE

The main alternative is to use the information from remote.heads() and
remote.lookup() to try to reconstruct enough graph information to
decide whether we are creating new heads. This is not adequate as
illustrated below.

Remember that each lookup is typically a request-response pair over
SSH or HTTP(S).

If we have a simple repository at the remote end like this:

(0:dev) ---- (1:dev) ---- (3:stable)
\
 `--- (2:dev)

then remote.heads() will yield [2, 3]. Assume we have nodes [0, 1, 2]
locally and want to create a new node, 4:dev, as a descendant from
(1:dev), which should be OK as 1:dev is a branch head.

If we do remote.lookup('dev') we will get [2]. Thus, we can get
information about whether a branch exists on the remote server or not,
but this does not solve our problem of figuring out whether we are
creating new heads or not.

Pushing 4:dev ought to be OK, since after the push, we still only have
two heads on branch a.

Using remote.lookup() and remote.heads() is thus not adequate to
consistently decide whether we are creating new remote heads (e.g. in
this situation the latter would never return 1:dev).

2.2. USING INCOMING TO RECONSTRUCT THE GRAPH

An alternative would be to use information equivalent to hg incoming
to get the full remote graph in addition to the local graph.

To do this, we would have to get a changegroup(subset) bundle
representing the remote end (which may be a substantial amount of
data), getting the branch heads from an instantiated bundlerepository,
deleting the bundle, and finally, we can compute the prepush logic.

While this is backwards compatible, it will cause a possibly
substantial slowdown of the push command as it first needs to pull in
all changes.


3. FURTHER ARGUMENTS IN FAVOUR OF THE BRANCHMAP WIRE-PROTOCOL EXTENSION

Currently, the commands incoming and pull, work based on the tip of a
given branch if used with "-r branchname", making it hard to get all
revisions of a certain branch only (if it has multiple heads). This
can be solved by requesting the remote's branchheads and letting the
revisions to be used with the command be these heads. This can be done
by extending the commands with a new option, e.g.:

hg pull -b branchname

which will be turned into the equivalent of:

hg pull -r branchhead1 -r branchhead2 -r branchhead3

We have a simple follow-up patch that can do this ready as well
(although not submitted yet as it is pending the acceptance of the
branch patch).


4. WRAP-UP

We generally find that the branchmap wire protocol extension can
provide better named branch support to Mercurial. Currently, some
things, like the initial push scenario in this mail, are fairly
counter-intuitive, and the more often you have to force push, the more
it is likely you will get a lot of spurious and unnecessary merge
nodes. Also, restricting incoming and pull to all changes on a branch
rather than changes on the tip-most head would be a sensible extension
to making named branches a first class citizen in Mercurial.
Currently, named branches sometimes feel like a late-coming unwanted
step-child.

We have run it in a production environment for a while, with fewer
multiple heads occurring in our repositories and fewer confused users
as a result.

Also, it fixes the long-standing issue 736.

Co-contributor: Sune Foldager <cryo@cyanite.org>
2009-05-23 17:02:49 +02:00
Benoit Boissinot
5b1d4a56ec filelog encoding: move the encoding/decoding into store
the escaping of directories ending with .i or .d doesn't
really belong to filelog.

we put the encoding/decoding in store instead, for backwards
compat, streamclone and the fncache file format still uses the
partially encoded filenames.
2009-05-20 18:35:47 +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