Alien-SVN
view release on metacpan or search on metacpan
src/subversion/subversion/tests/cmdline/patch_tests.py view on Meta::CPAN
None, # expected err
1, # check-props
1, # dry-run
'--reverse-diff')
def patch_dev_null(sbox):
"patch with /dev/null filenames"
sbox.build(read_only = True)
wc_dir = sbox.wc_dir
patch_file_path = make_patch_path(sbox)
# Git (and maybe other tools) use '/dev/null' as the old path for
# newly added files, and as the new path for deleted files.
# The path selection algorithm in 'svn patch' must detect this and
# avoid using '/dev/null' as a patch target.
unidiff_patch = [
"Index: new\n",
"===================================================================\n",
"--- /dev/null\n",
"+++ new (revision 0)\n",
"@@ -0,0 +1 @@\n",
"+new\n",
"\n",
"Index: A/B/E/beta\n",
"===================================================================\n",
"--- A/B/E/beta (revision 1)\n",
"+++ /dev/null\n",
"@@ -1 +0,0 @@\n",
"-This is the file 'beta'.\n",
]
svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
new_contents = "new\n"
expected_output = [
'A %s\n' % sbox.ospath('new'),
'D %s\n' % sbox.ospath('A/B/E/beta'),
]
expected_disk = svntest.main.greek_state.copy()
expected_disk.add({'new' : Item(contents=new_contents)})
expected_disk.remove('A/B/E/beta')
expected_status = svntest.actions.get_virginal_state(wc_dir, 1)
expected_status.add({'new' : Item(status='A ', wc_rev=0)})
expected_status.tweak('A/B/E/beta', status='D ')
expected_skip = wc.State('', { })
svntest.actions.run_and_verify_patch(wc_dir, os.path.abspath(patch_file_path),
expected_output,
expected_disk,
expected_status,
expected_skip,
None, # expected err
1, # check-props
1) # dry-run
@Issue(4049)
def patch_delete_and_skip(sbox):
"patch that deletes and skips"
sbox.build(read_only = True)
wc_dir = sbox.wc_dir
patch_file_path = make_patch_path(sbox)
os.chdir(wc_dir)
# We need to use abspaths to trigger the segmentation fault.
abs = os.path.abspath('.')
if sys.platform == 'win32':
abs = abs.replace("\\", "/")
outside_wc = os.path.join(os.pardir, 'X')
if sys.platform == 'win32':
outside_wc = outside_wc.replace("\\", "/")
unidiff_patch = [
"Index: %s/A/B/E/alpha\n" % abs,
"===================================================================\n",
"--- %s/A/B/E/alpha\t(revision 1)\n" % abs,
"+++ %s/A/B/E/alpha\t(working copy)\n" % abs,
"@@ -1 +0,0 @@\n",
"-This is the file 'alpha'.\n",
"Index: %s/A/B/E/beta\n" % abs,
"===================================================================\n",
"--- %s/A/B/E/beta\t(revision 1)\n" % abs,
"+++ %s/A/B/E/beta\t(working copy)\n" % abs,
"@@ -1 +0,0 @@\n",
"-This is the file 'beta'.\n",
"Index: %s/A/B/E/out-of-reach\n" % abs,
"===================================================================\n",
"--- %s/iota\t(revision 1)\n" % outside_wc,
"+++ %s/iota\t(working copy)\n" % outside_wc,
"\n",
"Property changes on: iota\n",
"___________________________________________________________________\n",
"Added: propname\n",
"## -0,0 +1 ##\n",
"+propvalue\n",
]
svntest.main.file_write(patch_file_path, ''.join(unidiff_patch))
skipped_path = os.path.join(os.pardir, 'X', 'iota')
expected_output = [
'D %s\n' % os.path.join('A', 'B', 'E', 'alpha'),
'D %s\n' % os.path.join('A', 'B', 'E', 'beta'),
'D %s\n' % os.path.join('A', 'B', 'E'),
'Skipped missing target: \'%s\'\n' % skipped_path,
] + svntest.main.summary_of_conflicts(skipped_paths=1)
expected_disk = svntest.main.greek_state.copy()
expected_disk.remove('A/B/E/alpha')
expected_disk.remove('A/B/E/beta')
expected_disk.remove('A/B/E')
expected_status = svntest.actions.get_virginal_state('', 1)
( run in 0.465 second using v1.01-cache-2.11-cpan-39bf76dae61 )