10547.1.2
by Michael Hudson
maybe this works |
1 |
# Copyright 2010 Canonical Ltd. This software is licensed under the
|
2 |
# GNU Affero General Public License version 3 (see the file LICENSE).
|
|
3 |
||
10547.1.5
by Michael Hudson
tests at the other end |
4 |
"""Implementations for the `seen_new_branch_hook` of `BranchFileSystemClient`.
|
5 |
"""
|
|
10547.1.2
by Michael Hudson
maybe this works |
6 |
|
7 |
__metaclass__ = type |
|
8 |
__all__ = ['SetProcTitleHook'] |
|
9 |
||
10 |
import setproctitle |
|
11 |
||
10547.1.5
by Michael Hudson
tests at the other end |
12 |
|
10547.1.2
by Michael Hudson
maybe this works |
13 |
class SetProcTitleHook: |
10547.1.5
by Michael Hudson
tests at the other end |
14 |
"""Use seen() as the hook to report branch access in ps(1) output."""
|
10547.1.2
by Michael Hudson
maybe this works |
15 |
|
10547.1.5
by Michael Hudson
tests at the other end |
16 |
def __init__(self, setproctitle_mod=None): |
10547.1.6
by Michael Hudson
writing tests is only much good if you run them |
17 |
if setproctitle_mod is None: |
10547.1.5
by Michael Hudson
tests at the other end |
18 |
setproctitle_mod = setproctitle |
10547.1.6
by Michael Hudson
writing tests is only much good if you run them |
19 |
self.setproctitle_mod = setproctitle_mod |
10547.1.5
by Michael Hudson
tests at the other end |
20 |
self.basename = setproctitle_mod.getproctitle() |
10547.1.2
by Michael Hudson
maybe this works |
21 |
|
22 |
def seen(self, branch_url): |
|
10547.1.3
by Michael Hudson
small tweaks from interactive playing. next: how to test? |
23 |
branch_url = branch_url.strip('/') |
10547.1.5
by Michael Hudson
tests at the other end |
24 |
self.setproctitle_mod.setproctitle( |
25 |
self.basename + ' BRANCH:' + branch_url) |