/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/builtins.py

  • Committer: Jelmer Vernooij
  • Date: 2019-04-06 16:43:15 UTC
  • mto: (7296.6.2 patch-silent)
  • mto: This revision was merged to the branch mainline in revision 7309.
  • Revision ID: jelmer@jelmer.uk-20190406164315-829rxxzhb9kpjznn
Fix some tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7025
7025
    takes_args = ['filename?']
7026
7026
    takes_options = [Option('strip', type=int, short_name='p',
7027
7027
                            help=("Strip the smallest prefix containing num "
7028
 
                                  "leading slashes  from filenames")),
 
7028
                                  "leading slashes from filenames.")),
7029
7029
                     Option('silent', help='Suppress chatter.')]
7030
7030
 
7031
7031
    def run(self, filename=None, strip=None, silent=False):
7032
7032
        from .patch import patch_tree
7033
 
        from bzrlib.workingtree import WorkingTree
7034
7033
        wt = WorkingTree.open_containing('.')[0]
7035
7034
        if strip is None:
7036
7035
            strip = 1
7037
7036
        my_file = None
7038
7037
        if filename is None:
7039
 
            my_file = sys.stdin
 
7038
            my_file = getattr(sys.stdin, 'buffer', sys.stdin)
7040
7039
        else:
7041
 
            my_file = open(filename)
 
7040
            my_file = open(filename, 'rb')
7042
7041
        patches = [my_file.read()]
7043
7042
        return patch_tree(wt, patches, strip, quiet=is_quiet(), out=self.outf)
7044
7043