3 # svneditor.py: a mock $SVN_EDITOR for the Subversion test suite
5 # Subversion is a tool for revision control.
6 # See http://subversion.tigris.org for more information.
8 # ====================================================================
9 # Copyright (c) 2006 CollabNet. All rights reserved.
11 # This software is licensed as described in the file COPYING, which
12 # you should have received as part of this distribution. The terms
13 # are also available at http://subversion.tigris.org/license-1.html.
14 # If newer versions of this license are posted there, you may use a
15 # newer version instead, at your option.
17 ######################################################################
23 if len(sys
.argv
) not in [2, 5]:
24 print "usage: svneditor.py file"
25 print " svneditor.py base theirs mine merged"
28 filename
= sys
.argv
[-1]
30 # Read in the input file.
35 funcname
= os
.environ
['SVNTEST_EDITOR_FUNC']
36 func
= sys
.modules
['__main__'].__dict
__[funcname
]
39 contents
= func(contents
)
41 # Write edited version back to the file.
42 f
= open(filename
, 'w')
47 return m
.replace('foo', 'bar')