Dulwich.io dulwich / a171853
Add porcelain 'daemon'. Remove dul-daemon script, and replace with 'dulwich daemon'. Jelmer Vernooń≥ 5 years ago
7 changed file(s) with 54 addition(s) and 28 deletion(s). Raw diff Collapse all Expand all
2323 IMPROVEMENTS
2424
2525 * Add porcelain 'status'. (Ryan Faulkner)
26
27 * Add porcelain 'daemon'. (Jelmer Vernooij)
2628
2729 * Add `dulwich.greenthreads` module which provides support
2830 for concurrency of some object store operations.
4446
4547 * Remove deprecated `num_objects` argument to `write_pack` methods.
4648 (Jelmer Vernooij)
49
50 OTHER CHANGES
51
52 * The 'dul-daemon' script has been removed. The same functionality
53 is now available as 'dulwich daemon'. (Jelmer Vernooij)
4754
4855 0.9.6 2014-04-23
4956
+0
-23
bin/dul-daemon less more
0 #!/usr/bin/python
1 # dul-daemon - Simple git-daemon-like server
2 # Copyright (C) 2008 John Carr <john.carr@unrouted.co.uk>
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; version 2
7 # or (at your option) a later version of the License.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17 # MA 02110-1301, USA.
18
19 from dulwich.server import main
20
21 if __name__ == '__main__':
22 main()
2828 import os
2929 import sys
3030 from getopt import getopt
31 import optparse
3132
3233 from dulwich import porcelain
3334 from dulwich.client import get_transport_and_path
244245 porcelain.reset('.', mode=mode, *args)
245246
246247
248 def cmd_daemon(args):
249 from dulwich import log_utils
250 from dulwich.protocol import TCP_GIT_PORT
251 parser = optparse.OptionParser()
252 parser.add_option("-l", "--listen_address", dest="listen_address",
253 default="localhost",
254 help="Binding IP address.")
255 parser.add_option("-p", "--port", dest="port", type=int,
256 default=TCP_GIT_PORT,
257 help="Binding TCP port.")
258 options, args = parser.parse_args(args)
259
260 log_utils.default_logging_config()
261 if len(args) > 1:
262 gitdir = args[1]
263 else:
264 gitdir = '.'
265 from dulwich import porcelain
266 porcelain.daemon(gitdir, address=options.listen_address,
267 port=options.port)
268
269
247270 commands = {
248271 "add": cmd_add,
249272 "archive": cmd_archive,
250273 "clone": cmd_clone,
251274 "commit": cmd_commit,
252275 "commit-tree": cmd_commit_tree,
276 "daemon": cmd_daemon,
253277 "diff": cmd_diff,
254278 "diff-tree": cmd_diff_tree,
255279 "dump-pack": cmd_dump_pack,
2323 * clone
2424 * commit
2525 * commit-tree
26 * daemon
2627 * diff-tree
2728 * init
2829 * list-tags
539540 else:
540541 raise AssertionError('git mv ops not yet supported')
541542 return tracked_changes
543
544
545 def daemon(path=".", address=None, port=None):
546 """Run a daemon serving Git requests over TCP/IP.
547
548 :param path: Path to the directory to serve.
549 """
550 # TODO(jelmer): Support git-daemon-export-ok and --export-all.
551 from dulwich.server import (
552 FileSystemBackend,
553 TCPGitServer,
554 )
555 backend = FileSystemBackend(path)
556 server = TCPGitServer(backend, address, port)
557 server.serve_forever()
883883 gitdir = args[1]
884884 else:
885885 gitdir = '.'
886 backend = FileSystemBackend(gitdir)
887 server = TCPGitServer(backend, options.listen_address,
888 port=options.port)
889 server.serve_forever()
886 from dulwich import porcelain
887 porcelain.daemon(gitdir, address=options.listen_address,
888 port=options.port)
890889
891890
892891 def serve_command(handler_cls, argv=sys.argv, backend=None, inf=sys.stdin,
593593 self.assertEqual(len(changes['add']), 0)
594594 self.assertEqual(len(changes['modify']), 0)
595595 self.assertEqual(len(changes['delete']), 1)
596
597
598 # TODO(jelmer): Add test for dulwich.porcelain.daemon
7272 in the particular Monty Python sketch.
7373 """,
7474 packages=['dulwich', 'dulwich.tests', 'dulwich.tests.compat', 'dulwich.contrib'],
75 scripts=['bin/dulwich', 'bin/dul-daemon', 'bin/dul-web', 'bin/dul-receive-pack', 'bin/dul-upload-pack'],
75 scripts=['bin/dulwich', 'bin/dul-web', 'bin/dul-receive-pack', 'bin/dul-upload-pack'],
7676 ext_modules=[
7777 Extension('dulwich._objects', ['dulwich/_objects.c'],
7878 include_dirs=include_dirs),