/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 bzrlib/gpg.py

  • Committer: Robert Collins
  • Date: 2010-05-06 11:08:10 UTC
  • mto: This revision was merged to the branch mainline in revision 5223.
  • Revision ID: robertc@robertcollins.net-20100506110810-h3j07fh5gmw54s25
Cleaner matcher matching revised unlocking protocol.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 by Canonical Ltd
 
1
# Copyright (C) 2005 Canonical Ltd
2
2
#   Authors: Robert Collins <robert.collins@canonical.com>
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
13
13
#
14
14
# You should have received a copy of the GNU General Public License
15
15
# along with this program; if not, write to the Free Software
16
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
16
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17
17
 
18
18
"""GPG signing and checking logic."""
19
19
 
 
20
import os
 
21
import sys
 
22
 
 
23
from bzrlib.lazy_import import lazy_import
 
24
lazy_import(globals(), """
20
25
import errno
21
 
import os
22
26
import subprocess
23
 
import sys
24
27
 
25
28
from bzrlib import (
26
29
    errors,
27
30
    trace,
28
31
    ui,
29
32
    )
 
33
""")
30
34
 
31
35
 
32
36
class DisabledGPGStrategy(object):
46
50
        """Real strategies take a configuration."""
47
51
 
48
52
    def sign(self, content):
49
 
        return content
 
53
        return ("-----BEGIN PSEUDO-SIGNED CONTENT-----\n" + content +
 
54
                "-----END PSEUDO-SIGNED CONTENT-----\n")
50
55
 
51
56
 
52
57
def _set_gpg_tty():
64
69
 
65
70
class GPGStrategy(object):
66
71
    """GPG Signing and checking facilities."""
67
 
        
 
72
 
68
73
    def _command_line(self):
69
74
        return [self._config.gpg_signing_command(), '--clearsign']
70
75
 
72
77
        self._config = config
73
78
 
74
79
    def sign(self, content):
 
80
        if isinstance(content, unicode):
 
81
            raise errors.BzrBadParameterUnicode('content')
75
82
        ui.ui_factory.clear_term()
76
83
 
77
84
        preexec_fn = _set_gpg_tty