Commit Graph

14321 Commits

Author SHA1 Message Date
Matt Mackall
66805ccfed revlog: stop exporting node.short 2011-05-21 15:01:28 -05:00
Patrick Mezard
272081b65d patch: fast-path git case in selectfile()
We avoid a lot of complicated heuristics in git cases, where these heurestics
may even be broken when copies are involved.
2011-05-19 22:55:13 +02:00
Patrick Mezard
a09607c9ee patch: unify backend file access interface
- Rename readlines() into getfile(), return data and mode
- Make setfile() write a data buffer instead of lines, make mode mandatory.
2011-05-19 22:49:43 +02:00
Patrick Mezard
701e9571f9 patch: merge backend setmode() into writelines()
Copy handling will be easier to handle in a single method.
2011-05-19 22:44:01 +02:00
Patrick Mezard
15861c0232 patch: stop modifying gitpatch objects
gitpatch objects emitted by iterhunks() were referencing file paths unmodified
from the input patch. _applydif() made them usable by modifying the gitpatch
objects in-place with specified path strip level. The same modified objects
were then reused by iterhunks() generator. _applydiff() now copies and update
the paths which completely decouples both routines.

As a side effect, the "git" event now receives only metadata about
copies/renames to perform the necessary copies ahead of time. Other actions are
handled in the "file" event.
2011-05-19 22:44:01 +02:00
Patrick Mezard
3246b5c773 patch: stop handling hunkless git blocks out of stream
Patch changes are emitted by iterhunks() in two separate events: 'file' when
hunks have to be applied and 'git' to describe other modifications like copies
or mode changes. Note that a file which mode is changed and which content is
modified by the same patch will be emitted in both events. It is more
convenient to handle all file modifications in a single event. This patch
"zips" git actions with regular changes so both kinds can be emitted at the
same place.
2011-05-19 22:44:01 +02:00
Patrick Mezard
ac0634bc33 patch: reindent code 2011-05-19 22:44:01 +02:00
Patrick Mezard
ac6f56515a patch: unify iterhunks() afile/bfile handling
git afile/bfile are extracted twice, once when reading a 'diff --git', and
again when reading a unified hunk. The problem is not all git blocks have
unified hunks (renames just have metadata) and they were not extracted the same
way. This is what this patch unifies.
2011-05-19 22:44:01 +02:00
Patrick Mezard
f8df1dcc42 patch: git metadata was ignored if strip > 1
gitpatch objects emitted by iterhunks() are modified in place by applydiff().
Processing them earlier improves iterhunks() isolation. applydiff() modifying
them should still be fixed though.
2011-05-19 22:44:01 +02:00
Patrick Mezard
68fd0dcbe7 patch: construct and parse binary hunks at the same time 2011-05-19 22:44:01 +02:00
Patrick Mezard
452fad17b8 patch: refactor iterhunks() regular and binary files emission 2011-05-19 22:44:01 +02:00
Patrick Mezard
78738c3822 patch: remove patch.patch() cwd argument 2011-05-19 22:44:01 +02:00
Patrick Mezard
6d4d079b0e patch: merge _updatedir() into externalpatch() 2011-05-19 22:44:01 +02:00
Martin Geisler
0eaeed4412 merge with stable 2011-05-19 18:10:03 +02:00
Martin Geisler
ff9aae8a76 changelog: convert user and desc from local encoding early
Failing to do so makes it impossible to use the memctx API to create a
changeset with a commit message or username outside of the current
encoding.encoding setting.
2011-05-19 18:09:25 +02:00
Martin Geisler
142cf677cd merge crew with main 2011-05-19 16:57:14 +02:00
Brendan Cully
b1b428c2d8 clone: make default path absolute for all local paths
This fixes the default path when cloning local repositories with hg-git, since
hg-git cancopy() is false even for local repositories.
2011-05-18 23:20:26 -07:00
Patrick Mezard
2bda8cbde2 patch: add a workingbackend dirstate layer on top of fsbackend
_updatedir() is no longer used by internalpatch()

The change in test-mq-missingfiles.t comes from workingbackend not considering
the missing 'b' file as changed, thus not calling addremove() on it.
2011-05-18 23:48:17 +02:00
Patrick Mezard
34a629b9c0 patch: handle binary copies as regular ones
This introduces a performance regression for large files, as they will be
copied just to be clobbered afterwards since binary patching does not use
deltas.  But it simplifies the code and the previous optimization will be
reintroduced later in a better way.
2011-05-18 23:48:13 +02:00
Patrick Mezard
18202a57db patch: remove files while patching, not in updatedir()
At this point, updatedir() only reads the working directory and update the
dirstate.
2011-05-18 23:48:13 +02:00
Patrick Mezard
514ff73602 patch: set desired mode when patching, not in updatedir()
This patch and the following aim at merging _updatedir() actions into
_applydiff().
2011-05-18 23:48:13 +02:00
Patrick Mezard
e5afef2782 patch: stop changing current directory before patching
_applydiff() patcher argument was added to help hgsubversion like extension
monkeypatching the patching process. While it could be removed at this point, I
prefer to leave it until patch.py is completely refactored and there is a valid
and tested alternative.
2011-05-18 23:48:13 +02:00
Sune Foldager
9a73f9bed3 revlog: linearize created changegroups in generaldelta revlogs
This greatly improves the speed of the bundling process, and often reduces the
bundle size considerably. (Although if the repository is already ordered, this
has little effect on both time and bundle size.)

For non-generaldelta clients, the reduced bundle size translates to a reduced
repository size, similar to shrinking the revlogs (which uses the exact same
algorithm). For generaldelta clients the difference is minor.

When the new bundle format comes, reordering will not be necessary since we
can then store the deltaparent relationsships directly. The eventual default
behavior for clients and servers is presented in the table below, where "new"
implies support for GD as well as the new bundle format:

                    old client                    new client
old server          old bundle, no reorder        old bundle, no reorder
new server, non-GD  old bundle, no reorder[1]     old bundle, no reorder[2]
new server, GD      old bundle, reorder[3]        new bundle, no reorder[4]

[1] reordering is expensive on the server in this case, skip it
[2] client can choose to do its own redelta here
[3] reordering is needed because otherwise the pull does a lot of extra
    work on the server
[4] reordering isn't needed because client can get deltabase in bundle
    format

Currently, the default is to reorder on GD-servers, and not otherwise. A new
setting, bundle.reorder, has been added to override the default reordering
behavior. It can be set to either 'auto' (the default), or any true or false
value as a standard boolean setting, to either force the reordering on or off
regardless of generaldelta.


Some timing data from a relatively branch test repository follows. All
bundling is done with --all --type none options.

Non-generaldelta, non-shrunk repo:
-----------------------------------
Size: 276M

Without reorder (default):
Bundle time: 14.4 seconds
Bundle size: 939M

With reorder:
Bundle time: 1 minute, 29.3 seconds
Bundle size: 381M

Generaldelta, non-shrunk repo:
-----------------------------------
Size: 87M

Without reorder:
Bundle time: 2 minutes, 1.4 seconds
Bundle size: 939M

With reorder (default):
Bundle time: 25.5 seconds
Bundle size: 381M
2011-05-18 23:26:26 +02:00
Sune Foldager
354fe2aa7b revlogdag: add linearize function
See the docstring for a detailed explanation. The linearizer was originally
written by Benoit Boissinot.
2011-05-18 23:11:34 +02:00
Martin Geisler
b8eb9675f3 localrepo, sshrepo: use Boolean create argument in __init__ 2011-05-18 19:30:17 +02:00
Martin Geisler
aac60bcbc9 commands: replace 'x = f(); return x' with 'return f()' 2011-05-18 19:25:34 +02:00
Martin Geisler
c3877c2424 merge with stable 2011-05-18 19:22:55 +02:00
Thomas Arendsen Hein
843bd0fb63 run-tests: print a newline after all warnings 2011-05-18 15:45:57 +02:00
Thomas Arendsen Hein
5921e1efcc annotate: fix alignment of columns in front of line numbers (issue2807) 2011-05-18 15:41:03 +02:00
Martin Geisler
3eec57aed2 subrepo: respect non-default path for incoming/outgoing
Push and pull set repo._subtoppath before pushing or pulling subrepos.
The incoming and outgoing commands needed to do the same.
2011-05-18 15:13:26 +02:00
Martin Geisler
9bc622d2ad merge with stable 2011-05-18 09:56:27 +02:00
Martin Geisler
9ea41d9e6c revset: the name is optional for the tag predicate 2011-05-18 09:31:19 +02:00
Martin Geisler
c9db075708 revset: note case-sensitive match in grep 2011-05-18 09:28:11 +02:00
Martin Geisler
009dc5d112 revset: note case-insensitive matches in keyword and user 2011-05-18 09:20:52 +02:00
Martin Geisler
e7ee99da82 revset: expand help for contains predicate 2011-05-18 09:15:18 +02:00
Sune Foldager
3549e9b445 patch: remove unused variable to make pyflakes test happy 2011-05-18 09:05:18 +02:00
Patrick Mezard
42f681d4d9 patch: add lexists() to backends, use it in selectfile()
At this point, all applydiff() filesystem calls should pass through fsbackend.
2011-05-17 23:46:38 +02:00
Patrick Mezard
c3cc8c546a patch: move copyfile() into backends, abstract basedir 2011-05-17 23:46:38 +02:00
Patrick Mezard
6b9f641c33 patch: merge makerejlines() into write_rej() 2011-05-17 23:46:37 +02:00
Patrick Mezard
431a9d156a patch: extract fs access from patchfile into fsbackend
Most filesystem calls are already isolated in patchfile but this is not enough:
renames are performed before patchfile is available and some chmod calls are
even done outside of the applydiff call. Once all these calls are extracted
into a backend class, we can provide cleaner APIs to write to a working
directory context directly into the repository.
2011-05-17 23:46:15 +02:00
Patrick Mezard
45494955e5 mq: fix qpush changes detection of renamed files
patch.changedfile() was not considering renamed file source as changed.
2011-05-17 23:27:58 +02:00
Augie Fackler
5086ed5b5d httpclient: import revision fc731618702a of py-nonblocking-http 2011-05-17 10:28:03 -05:00
Augie Fackler
d61478c8ef httpconnection: correctly handle redirects from http to https
Previously the connection cache for keepalives didn't keep track of
ssl. This meant that when we connected to an https server after that
same server via http, both on the default port, we'd incorrectly reuse
the non-https connection as the default port meant the connection
cache key was the same.
2011-05-16 16:59:45 -05:00
Augie Fackler
640a6e5b0b httpconnection: improved logging formatting
I had to use this debugging output for the first time recently when
looking for a problem, and the lack of good formatting made things
difficult.
2011-05-16 16:59:45 -05:00
Yann E. MORIN
e113e69fa1 bash_completion: enable alias auto-complete
When auto-completing, set HGPLAINEXCEPT=alias to list aliases
in the suggestions.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-05-17 00:46:52 +02:00
Yann E. MORIN
236f8c6745 ui: enable alias exception when reading config in plain mode
When in plain mode with "alias" present in the exception list,
keep the aliases. This will be used later to enable auto-completion.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-05-17 00:17:52 +02:00
Yann E. MORIN
013aed8037 ui: test plain mode against exceptions
Let ui.plain() accept an optional parameter in the form of a feature
name (as a string) to exclude from plain mode.

The result of ui.plain is now:
 - False if HGPLAIN is not set or the requested feature is in HGPLAINEXCEPT
 - True otherwise

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
2011-05-17 00:08:51 +02:00
Matt Mackall
a6f2ad6f1e revlog: drop base() again
deltaparent does what's needed, and more "portably".
2011-05-18 17:05:30 -05:00
Adrian Buehlmann
5884f8cd09 win32.py: add argtypes and restype
This is a feature of ctypes. Without these, pypy complains with

  RuntimeWarning: C function without declared arguments called
  RuntimeWarning: C function without declared return type called

As a side effect of specifying restypes, the return value of e.g. CreateFileA
is now implicitly converted to an instance of _HANDLE, so we also need to
change the definition

  _INVALID_HANDLE_VALUE = -1

to

  _INVALID_HANDLE_VALUE = _HANDLE(-1).value

Otherwise, tests for equality to _INVALID_HANDLE_VALUE in code like

  def _getfileinfo(name):
      fh = _kernel32.CreateFileA(name, 0,
              _FILE_SHARE_READ | _FILE_SHARE_WRITE | _FILE_SHARE_DELETE,
              None, _OPEN_EXISTING, 0, None)
      if fh == _INVALID_HANDLE_VALUE:
          _raiseoserror(name)

would now fail to detect an invalid handle, which in turn would lead to
exceptions raised with wrong errno values, like e.g.

  >>> nlinks('missing.txt')
  Traceback (most recent call last):
  ...
  OSError: [Errno 9] missing.txt: The handle is invalid.

instead of the correct (as per this patch and before it)

  >>> nlinks('missing.txt')
  Traceback (most recent call last):
  ...
  OSError: [Errno 2] missing.txt: The system cannot find the file specified.
2011-05-15 21:33:51 +02:00
Adrian Buehlmann
1301f80255 win32.py: more explicit definition of _STD_ERROR_HANDLE 2011-05-15 21:27:59 +02:00