Commit Graph

19 Commits

Author SHA1 Message Date
Pierre-Yves David
5fa2b0e756 vfs: use 'vfs' module directly in 'mercurial.unionrepo'
Now that the 'vfs' classes moved in their own module, lets use the new module
directly. We update code iteratively to help with possible bisect needs in the
future.
2017-03-02 14:49:50 +01:00
Remi Chaintron
6d11b9177b revlog: add 'raw' argument to revision and _addrevision
This patch introduces a new 'raw' argument (defaults to False) to revlog's
revision() and _addrevision() methods.
When the 'raw' argument is set to True, it indicates the revision data should be
handled as raw data by the flagprocessor.

Note: Given revlog.addgroup() calls are restricted to changegroup generation, we
can always set raw to True when calling revlog._addrevision() from
revlog.addgroup().
2017-01-05 17:16:07 +00:00
Pulkit Goyal
97f340e354 py3: use pycompat.getcwd() instead of os.getcwd()
We have pycompat.getcwd() which returns bytes path on Python 3. This patch
changes most of the occurences of the os.getcwd() with pycompat one.
2016-11-23 00:03:11 +05:30
Durham Goode
5886722a46 manifest: add unionmanifestlog support
As part of deprecating manifest, we need to make the union repo support
manifestlog.
2016-11-11 01:20:13 -08:00
Durham Goode
757b6fb5aa manifest: move manifest creation to a helper function
A future patch will be moving manifest creation to be inside manifestlog as part
of improving our cache guarantees. bundlerepo and unionrepo currently rely on
being able to hook into manifest creation, so let's temporarily move the actual
manifest creation to a helper function for them to intercept.

In the future manifest.manifest() will disappear entirely and this can
disappear.
2016-10-18 17:32:51 -07:00
Pierre-Yves David
c93d28cfa7 unionrepo: properly handle hidden linkrev in revlog (issue5070)
The unionrepository have to do some special magic to handle linkrev of the
unioned filerev and manifestrev. That logic was done from a repoview and
obsolescence marker affecting bundled changeset could lead to a crash. We now
ensure we operate on unfiltered repository.
2016-02-22 23:36:04 +01:00
Matt Mackall
cfd1f81556 merge with stable 2016-01-13 15:47:37 -06:00
Sean Farley
5e2327758b unionrepo: fix wrong rev being checked in iscensored (issue5024) 2016-01-06 11:01:55 -08:00
Mike Edgar
44af48ee4a changegroup: add flags field to cg3 delta header
This lets revlog flags be transmitted over the wire. Right now this is
useful for censored nodes and for narrowhg's ellipsis nodes.
2015-12-14 15:55:12 -05:00
Pierre-Yves David
30913031d4 error: get Abort from 'error' instead of 'util'
The home of 'Abort' is 'error' not 'util' however, a lot of code seems to be
confused about that and gives all the credit to 'util' instead of the
hardworking 'error'. In a spirit of equity, we break the cycle of injustice and
give back to 'error' the respect it deserves. And screw that 'util' poser.

For great justice.
2015-10-08 12:55:45 -07:00
Pierre-Yves David
ec3df4a4f5 unionrepo: take delta base in account with building unified revlog
When general delta is enabled, the base is actually meaningful and should be
used. With general delta is enabled, test-unionrepo.t crash without this fix.
2015-09-10 16:14:39 -07:00
Gregory Szorc
46b99aa213 unionrepo: use absolute_import 2015-08-08 20:13:11 -07:00
FUJIWARA Katsunori
29b6ee5ded unionrepo: use pathutil.normasprefix to ensure os.sep at the end of cwd
Since Python 2.7.9, "os.path.join(path, '')" doesn't add "os.sep" at
the end of UNC path (see issue4557 for detail).

This makes unionrepo incorrectly work, if:

  1. cwd is the root of UNC share (e.g. "\host\share"), and
  2. mainreporoot is near cwd (e.g. "\host\sharefoo\repo")
     - host of UNC path is same as one of cwd
     - share of UNC path starts with one of cwd
  3. "repopath" isn't specified in URI (e.g. "union:path/to/repo2")

For example:

  $ hg --cwd \host\share -R \host\sharefoo\repo incoming union:path\to\repo2

In this case:

  - os.path.join(r"\host\share", "") returns r"\host\share",
  - r"\host\sharefoo\repo".startswith(r"\host\share") returns True, then
  - r"foo\repo" is treated as repopath of unionrepo instead of
    r"\host\sharefoo\repo"

This causes failure of combining "\host\sharefoo\repo" and another
repository: in addition to it, "\host\share\foo\repo" may be combined
with another repository, if it accidentally exists.

This patch uses "pathutil.normasprefix()" to ensure "os.sep" at the
end of cwd safely, even with some problematic encodings, which use
0x5c (= "os.sep" on Windows) as the tail byte of some multi-byte
characters.

BTW, normalization before "pathutil.normasprefix()" isn't needed in
this case, because "os.getcwd()" always returns normalized one.
2015-04-22 23:38:55 +09:00
Mike Edgar
c736894d9c revlog: add "iscensored()" to revlog public API
The iscensored method will be used by the exchange layer to reject
nonconforming deltas involving censored revisions (and to produce
conforming deltas).

For background and broader design of the censorship feature, see:
http://mercurial.selenic.com/wiki/CensorPlan
2015-01-23 17:01:39 -05:00
Mike Edgar
bd60d594d0 filelog: remove unused _file method 2015-01-22 11:09:34 -05:00
Angel Ezquerra
6e49f7def8 localrepo: remove all external users of localrepo.sopener
This change touches every module in which repository.sopener was being used, and
changes it for the equivalent repository.svfs.

It should now be possible to remove localrepo.sopener.
2015-01-11 00:25:54 +01:00
Mads Kiilerich
2629efac4f config: set a 'source' in most cases where config don't come from file but code
Some extensions set configuration settings that showed up in 'hg showconfig
--debug' with 'none' as source. That was confusing.

Instead, they will now tell which extension they come from.

This change tries to be consistent and specify a source everywhere - also where
it perhaps is less relevant.
2014-03-19 02:45:14 +01:00
Wojciech Lopata
9eb979f33b unionrevlog: extract 'baserevision' and 'baserevdiff' methods
This makes possible to use unionrevlog class with subclasses of revlog that
override revlog's 'revision' and 'revdiff' methods. In particular this change
is necessary to implement manifest compression, as it allows extension to
replace manifest class and override 'revision' amd 'revdiff' methods there.
2013-08-26 17:11:01 -07:00
Mads Kiilerich
64f616517b unionrepo: read-only operations on a union of two localrepos
unionrepo is just like bundlerepo without bundles.

The implementation is very similar to bundlerepo, but I don't see any obvious
way to generalize it.

Some most obvious use cases for this would be log and diff across local repos,
as a kind of preview of pulls, for instance:

  $ hg -R union:repo1+repo2 heads
  $ hg -R union:repo1+repo2 log -r REPO1REV -r REPO2REV
  $ hg -R union:repo1+repo2 log -r '::REPO1REV-::REPO2REV'
  $ hg -R union:repo1+repo2 log -r 'ancestor(REPO1REV,REPO2REV)'
  $ hg -R union:repo1+repo2 diff -r REPO1REV -r REPO2REV

This is going to be used in RhodeCode, and Bitbucket already uses something
similar. Having a core implementation would be beneficial.
2013-01-18 15:54:09 +01:00