[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH v2] Reject checkouts to existing directory

From: Patrick Steinhardt <patrick.steinhardt_at_elegosoft.com>
Date: Tue, 18 Oct 2016 14:22:25 +0200

Hi,

finally got around to update my patch regarding checkouts to
existing directories. The semantics have been changed to accept
checkouts iff

- the target directory does not exist
- the target directory is empty
- the repository to check out is empty
- the --force flag is given

This should treat all cases pointed out by Ivan. There were quite
a lot of test cases that needed adjustment following this change.
I've mostly added the '--force' flag, but also replaced a test
which didn't make sense anymore with a new one (that is 'co to a
dir without --force with obstructions'). The new test case simply
check is we reject checking out a non-empty repo to a non-empty
dir.

All but two unrelated tests pass with this.

[[[
Reject checkouts which would create tree conflicts.

When a new checkout is done where the target dirctory already
exists, subversion will usually create a lot of tree conflicts
which are intimidating, especially to new users. This behavior
stems from release 1.8, where we started accepting checkouts to
existing directories without any safety-checks.

This patch changes semantics in that it introduces new safety
checks so that the user does not accidentally shoots himself into
the foot. We now only allow checkouts if one of the following
conditions holds true:

- the target directory does not exist
- the target directory is empty
- the repository to check out is empty
- the --force flag is given

The main use case solved by the above conditions is for
converting existing directories into a repository when the
repository is newly created.

* subversion/svn/checkout-cmd.c:
  (listing_cb): New callback to check whether the remote
   repository is empty.
  (verify_checkout_target): New function to check whether the
   target checkout directory is a valid one.
  (svn_cl__checkout): Now calls `verify_checkout_target` if no
   --force is specified.
* subversion/tests/cmdline/autoprop_tests.py:
  (autoprops_test,
   inheritable_autoprops_test): use 'co --force'.
* subversion/tests/cmdline/basic_tests.py:
  (basic_checkout,
   basic_auth_test): use 'co --force'.
* subversion/tests/cmdline/checkout_tests.py:
  (checkout_with_obstructions): Replace old test and now assert
   that subversion refuses to checkout to non-empty dirs.
* subversion/tests/cmdline/svntest/actions.py:
  (run_and_verify_checkout): use 'co --force'.
* subversion/tests/cmdline/tree_conflict_tests.py:
  (ensure_tree_conflict): use 'co --force'.
]]]

Regards
Patrick

-- 
Patrick Steinhardt, Entwickler
elego Software Solutions GmbH, http://www.elego.de
Gebäude 12 (BIG), Gustav-Meyer-Allee 25, 13355 Berlin, Germany
Sitz der Gesellschaft: Berlin, USt-IdNr.: DE 163214194
Handelsregister: Amtsgericht Charlottenburg HRB 77719
Geschäftsführer: Olaf Wagner

Received on 2016-10-18 14:22:43 CEST

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.