~abentley/bzrtools/bzrtools.dev

« back to all changes in this revision

Viewing changes to __init__.py

  • Committer: ghigo
  • Date: 2006-03-03 20:40:43 UTC
  • mto: This revision was merged to the branch mainline in revision 330.
  • Revision ID: ghigo@venice-20060303204043-a0355f76fb8f6b1a
add support for bazaar diff

Show diffs side-by-side

added added

removed removed

Lines of Context:
98
98
strip_help="""Strip the smallest prefix containing num leading slashes  from \
99
99
each file name found in the patch file."""
100
100
Option.OPTIONS['strip'] = Option('strip', type=int, help=strip_help)
 
101
Option.OPTIONS['bzrdiff'] = Option('bzrdiff',type=None,
 
102
                                help="""Handle extra bzr tags""")
101
103
class cmd_patch(bzrlib.commands.Command):
102
104
    """Apply a named patch to the current tree.
103
105
    """
104
106
    takes_args = ['filename?']
105
 
    takes_options = ['strip']
106
 
    def run(self, filename=None, strip=1):
 
107
    takes_options = ['strip','bzrdiff']
 
108
    def run(self, filename=None, strip=-1, bzrdiff=0):
107
109
        from patch import patch
108
110
        from bzrlib.branch import Branch
109
111
        b = Branch.open_containing('.')[0]
110
 
        return patch(b, filename, strip)
 
112
        if strip == -1:
 
113
            if bzrdiff: strip = 0
 
114
            else:       strip = 1
 
115
 
 
116
        return patch(b, filename, strip, legacy= not bzrdiff)
111
117
 
112
118
 
113
119
class cmd_shelve(bzrlib.commands.Command):