Chia-liang Kao <clkao@clkao.org> writes:
> Hi,
>
> attached is a test case.
Thanks! Next time, can you put a [PATCH] is the subject next time? I
just added it, so this thread will be filtered properly. This is
documented in HACKING.
> I'm not sure what behaviour should it be, maybe print a warning
> or so. but it shouldn't fail IMHO.
I agree; this is only one example where 'svn merge' is too fragile.
It should print warnings whenever a change can't be applied, rather
than throwing an error and quitting. I've seen other examples of this
kind of behavior.
> I tried to fix it in merge_file_changed, because svn_wc_merge
> requires target to exist. but svn_repos_dir_delta only gets in
> merge_file_changed when dry-run is turned on.
>
> maybe someone familiar with the reporter/update_editor could
> fix this easily.
Can you file this recipe/patch as an issue? We have a number of 'svn
merge' bugs.
> Index: merge_tests.py
> ===================================================================
> --- merge_tests.py (revision 6392)
> +++ merge_tests.py (working copy)
> @@ -843,6 +843,52 @@
> os.chdir(saved_cwd)
I'm thrilled that you're writing regression tests... but let me give
you a few pointers. :-)
> + outlines,errlines = svntest.main.run_svn(None, 'ci', '-m', 'rev 3', B_path)
> + if errlines:
> + raise svntest.Failure
[...]
> + outlines,errlines = svntest.main.run_svn(None, 'up', os.path.join(wc_dir,'A'))
> + if errlines:
> + raise svntest.Failure
If you look throughout our test suite, you'll notice that this isn't
the way we perform commits or updates. The "proper" way is to build
three trees: an expected output tree ("what output paths will the
command print?"), an expected status tree ("what will 'svn st -v' say
after the command finishes?"), and an expected disk tree ("what will
the wc file contents be after the command finishes?") That's why we
have a python tree-class. Once you build the expected trees, you pass
them to svntest.actions.run_and_verify_[commit|update](), which runs
the command and compares actual trees with expected trees.
If you simply check for error, you don't really know if the command
behaved the way you expected; you just know that it didn't bomb out. :-)
> + saved_cwd = os.getcwd()
> + try:
> + os.chdir(I_path)
> + out, err = svntest.main.run_svn(0, 'merge', '-r', '2:3', B_url)
> + if err:
> + raise svntest.Failure
> + finally:
> + os.chdir(saved_cwd)
Yikes! Why do you have to chdir() here? Why not just run
'svn merge -r 2:3 B_url I_path'
The last argument certainly doesn't have to be '.' !
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sun Jul 6 16:18:02 2003