mercurial/bundlerepo.py
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
Fri, 30 Nov 2012 00:43:55 +0900
branchstable
changeset 18006 0c10cf819146
parent 17193 1d710fe5ee0e
child 17913 03e552aaae67
child 18138 8ab0640c3090
permissions -rw-r--r--
subrepo: add argument to "diff()" to pass "ui" of caller side (issue3712) (API) Color extension achieves colorization by overriding the class of "ui" object just before command execution. Before this patch, "diff()" of abstractsubrepo and classes derived from it has no "ui" argument, so "diff()" of hgsubrepo uses "self._repo.ui" to invoke "cmdutil.diffordiffstat()". For separation of configuration between repositories, revision 573bec4ab7ba changed the initialization source of "self._repo.ui" from "ui"(overridden) to "baseui"(plain) of parent repository. And this caused break of colorization. This patch adds "ui" argument to "diff()" of abstractsubrepo and classes derived from it to pass "ui" object of caller side.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8226
8b2cd04a6e97 put license and copyright info into comment blocks
Martin Geisler <mg@lazybytes.net>
parents: 8225
diff changeset
     1
# bundlerepo.py - repository class for viewing uncompressed bundles
8b2cd04a6e97 put license and copyright info into comment blocks
Martin Geisler <mg@lazybytes.net>
parents: 8225
diff changeset
     2
#
8b2cd04a6e97 put license and copyright info into comment blocks
Martin Geisler <mg@lazybytes.net>
parents: 8225
diff changeset
     3
# Copyright 2006, 2007 Benoit Boissinot <bboissin@gmail.com>
8b2cd04a6e97 put license and copyright info into comment blocks
Martin Geisler <mg@lazybytes.net>
parents: 8225
diff changeset
     4
#
8b2cd04a6e97 put license and copyright info into comment blocks
Martin Geisler <mg@lazybytes.net>
parents: 8225
diff changeset
     5
# This software may be used and distributed according to the terms of the
10263
25e572394f5c Update license to GPLv2+
Matt Mackall <mpm@selenic.com>
parents: 9676
diff changeset
     6
# GNU General Public License version 2 or any later version.
1942
9da45de3118d add bundlerepo.py: a read-only repo that can use uncompressed bundles
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
     7
8227
0a9542703300 turn some comments back into module docstrings
Martin Geisler <mg@lazybytes.net>
parents: 8226
diff changeset
     8
"""Repository class for viewing uncompressed bundles.
0a9542703300 turn some comments back into module docstrings
Martin Geisler <mg@lazybytes.net>
parents: 8226
diff changeset
     9
0a9542703300 turn some comments back into module docstrings
Martin Geisler <mg@lazybytes.net>
parents: 8226
diff changeset
    10
This provides a read-only repository interface to bundles as if they
0a9542703300 turn some comments back into module docstrings
Martin Geisler <mg@lazybytes.net>
parents: 8226
diff changeset
    11
were part of the actual repository.
0a9542703300 turn some comments back into module docstrings
Martin Geisler <mg@lazybytes.net>
parents: 8226
diff changeset
    12
"""
0a9542703300 turn some comments back into module docstrings
Martin Geisler <mg@lazybytes.net>
parents: 8226
diff changeset
    13
7873
4a4c7f6a5912 cleanup: drop unused imports
Peter Arrenbrecht <peter.arrenbrecht@gmail.com>
parents: 7853
diff changeset
    14
from node import nullid
3891
6b4127c7d52a Simplify i18n imports
Matt Mackall <mpm@selenic.com>
parents: 3877
diff changeset
    15
from i18n import _
14158
d8ba6fb2ce15 bundlerepo: drop struct
Matt Mackall <mpm@selenic.com>
parents: 14144
diff changeset
    16
import os, tempfile, shutil
16042
4b7aa1c899dc bundlerepo: try to find containing repo on creation (issue1812)
Matt Mackall <mpm@selenic.com>
parents: 15597
diff changeset
    17
import changegroup, util, mdiff, discovery, cmdutil
14076
924c82157d46 url: move URL parsing functions into util to improve startup time
Brodie Rao <brodie@bitheap.org>
parents: 14073
diff changeset
    18
import localrepo, changelog, manifest, filelog, revlog, error
1942
9da45de3118d add bundlerepo.py: a read-only repo that can use uncompressed bundles
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    19
1946
9fee186f7f0d bundlerepo: remove relative import, fix a comment
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1942
diff changeset
    20
class bundlerevlog(revlog.revlog):
14142
cb91ea6af733 bundlerepo: port to new bundle API
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 14076
diff changeset
    21
    def __init__(self, opener, indexfile, bundle, linkmapper):
1942
9da45de3118d add bundlerepo.py: a read-only repo that can use uncompressed bundles
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    22
        # How it works:
9da45de3118d add bundlerepo.py: a read-only repo that can use uncompressed bundles
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    23
        # to retrieve a revision, we need to know the offset of
12332
680fe77ab5b8 bundlerepo: use bundle objects everywhere
Matt Mackall <mpm@selenic.com>
parents: 12331
diff changeset
    24
        # the revision in the bundle (an unbundle object).
1942
9da45de3118d add bundlerepo.py: a read-only repo that can use uncompressed bundles
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    25
        #
9da45de3118d add bundlerepo.py: a read-only repo that can use uncompressed bundles
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
    26
        # We store this offset in the index (start), to differentiate a