/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/git/server.py

  • Committer: Gustav Hartvigsson
  • Date: 2021-01-09 21:36:27 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20210109213627-h1xwcutzy9m7a99b
Added 'Case Preserving Working Tree Use Cases' from Canonical Wiki

* Addod a page from the Canonical Bazaar wiki
  with information on the scmeatics of case
  perserving filesystems an a case insensitive
  filesystem works.
  
  * Needs re-work, but this will do as it is the
    same inforamoton as what was on the linked
    page in the currint documentation.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
# along with this program; if not, write to the Free Software
17
17
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18
18
 
19
 
from __future__ import absolute_import
20
 
 
21
19
from dulwich.server import TCPGitServer
22
20
 
23
21
import sys
33
31
 
34
32
from .mapping import (
35
33
    default_mapping,
 
34
    decode_git_path,
36
35
    )
37
36
from .object_store import (
38
37
    BazaarObjectStore,
60
59
 
61
60
    def open_repository(self, path):
62
61
        # FIXME: More secure path sanitization
63
 
        transport = self.transport.clone(path.decode('utf-8').lstrip("/"))
 
62
        transport = self.transport.clone(decode_git_path(path).lstrip("/"))
64
63
        trace.mutter('client opens %r: %r', path, transport)
65
64
        return BzrBackendRepo(transport, self.mapping)
66
65
 
92
91
            have = self.object_store.find_common_revisions(graph_walker)
93
92
            if wants is None:
94
93
                return
 
94
            shallows = getattr(graph_walker, 'shallow', frozenset())
95
95
            if isinstance(self.object_store, BazaarObjectStore):
96
96
                return self.object_store.generate_pack_contents(
97
 
                    have, wants, progress, get_tagged=get_tagged, lossy=True)
 
97
                    have, wants, shallow=shallows,
 
98
                    progress=progress, get_tagged=get_tagged, lossy=True)
98
99
            else:
99
 
                return self.object_store.generate_pack_contents(
100
 
                    have, wants, progress)
 
100
                if shallows:
 
101
                    return self.object_store.generate_pack_contents(
 
102
                        have, wants, shallow=shallows, progress=progress)
 
103
                else:
 
104
                    return self.object_store.generate_pack_contents(
 
105
                        have, wants, progress=progress)
101
106
 
102
107
 
103
108
class BzrTCPGitServer(TCPGitServer):
165
170
 
166
171
def serve_git_receive_pack(transport, host=None, port=None, inet=False):
167
172
    if not inet:
168
 
        raise errors.BzrCommandError(
 
173
        raise errors.CommandError(
169
174
            "git-receive-pack only works in inetd mode")
170
175
    backend = BzrBackend(transport)
171
176
    sys.exit(serve_command(ReceivePackHandler, backend=backend))
173
178
 
174
179
def serve_git_upload_pack(transport, host=None, port=None, inet=False):
175
180
    if not inet:
176
 
        raise errors.BzrCommandError(
 
181
        raise errors.CommandError(
177
182
            "git-receive-pack only works in inetd mode")
178
183
    backend = BzrBackend(transport)
179
184
    sys.exit(serve_command(UploadPackHandler, backend=backend))