Skip to content

Commit

Permalink
Merge pull request #89 from matthewrmshin/fix-get-wc-root-without-dot…
Browse files Browse the repository at this point in the history
…-svn-entries

Use `svn info` to get working copy root
  • Loading branch information
benfitzpatrick committed Feb 3, 2014
2 parents 4a97793 + 6075a77 commit 52d6de3
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 8 deletions.
7 changes: 7 additions & 0 deletions lib/FCM/System/CM/SVN.pm
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,13 @@ sub _get_log_handle_text_path {
sub _get_wc_root {
my ($attrib_ref, $path) = @_;
$path ||= cwd();
my ($entries_ref) = _get_info($attrib_ref, $path);
if ( defined($entries_ref)
&& @{$entries_ref}
&& exists($entries_ref->[0]->{'wc-info:wcroot-abspath'})
) {
return $entries_ref->[0]->{'wc-info:wcroot-abspath'};
}
if (-f $path) {
$path = dirname($path);
}
Expand Down
29 changes: 21 additions & 8 deletions t/fcm-switch/00-simple.t
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
#-------------------------------------------------------------------------------
. $(dirname $0)/test_header
#-------------------------------------------------------------------------------
tests 9
tests 12
#-------------------------------------------------------------------------------
setup
init_repos
Expand All @@ -32,9 +32,7 @@ cd $TEST_DIR/wc
# Tests fcm switch trunk
svn switch -q $ROOT_URL/branches/dev/Share/merge1
TEST_KEY=$TEST_KEY_BASE-trunk
run_pass "$TEST_KEY" fcm switch trunk <<__IN__
y
__IN__
run_pass "$TEST_KEY" fcm switch trunk <<<'y'
file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
switch: status of "$TEST_DIR/wc":
? unversioned_file
Expand All @@ -55,9 +53,7 @@ file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
# Tests fcm switch merge1 branch
rm unversioned_file
TEST_KEY=$TEST_KEY_BASE-branch-1
run_pass "$TEST_KEY" fcm switch branches/dev/Share/merge1 <<__IN__
y
__IN__
run_pass "$TEST_KEY" fcm switch branches/dev/Share/merge1 <<<'y'
file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<__OUT__
U subroutine/hello_sub_dummy.h
A added_file
Expand Down Expand Up @@ -92,5 +88,22 @@ A renamed_added_file
Updated to revision 9.
__OUT__
file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
teardown
#-------------------------------------------------------------------------------
# Tests fcm switch trunk, without .svn/entries
TEST_KEY=$TEST_KEY_BASE-trunk-2
if $SVN_VERSION_IS_16; then
skip 3 "$TEST_KEY won't work under Subversion 1.6"
else
rm -f .svn/entries
run_pass "$TEST_KEY" fcm switch trunk <<<'y'
file_cmp "$TEST_KEY.out" "$TEST_KEY.out" <<'__OUT__'
D renamed_added_file
U subroutine/hello_sub.h
U lib/python/info/__init__.py
Updated to revision 9.
__OUT__
file_cmp "$TEST_KEY.err" "$TEST_KEY.err" </dev/null
fi
#-------------------------------------------------------------------------------
teardown
exit

0 comments on commit 52d6de3

Please sign in to comment.