With svnlite, you can also use a quarterly branch instead of the latest/head snapshot that portsnap limits you to, in which case, you would also want to know how to switch branches to be able to change your ports tree to a newer or older branch:
Code:
# Switch to the 2020Q2 branch (the one before the current 2020Q3 branch)
svnlite switch ^/branches/2020Q2 /usr/ports
# Switch to head
svnlite switch ^/head /usr/ports
New
portsnap(8) switches like
-q
for quarterly and
-h
for head would accomplish the same thing, but then you have arguments about whether portsnap should default to the new
-q
behavior or retain compatibility with
-h
being implied.
I still would prefer svnlite, however, because it means I don't need to download a large snapshot tarball every time: a set of diffs is a lot smaller than a full tree. Just don't delete the
.svn/ directory at the top of the tree, else it's no better than portsnap.
That said, svn/svnlite does have at least one downside beyond knowing what URL to use for initial checkout: running
find(1) or
grep -r
in the toplevel
/usr/ports directory will result in searching the
/usr/ports/.svn directory as well, so you need to find a way to exclude that directory; how you accomplish that can depend on the context of your search. Of course this applies to git as well.
As for the svn/git argument, git is definitely faster. GhostBSD actually
disabled the svn prompt by default in its shells/fish port because it was so slow in large repos that even
cd dirname
took several seconds to wait for the svn command to complete before printing the shell prompt.
Of course, git is also more complicated to use since most git commands other than
git-clone(1) and
git-init(1) require you to already be inside the checked-out source tree. As an example, a simple and intuitive one-liner like
svnlite update /usr/ports
becomes the more complex
sh -c 'cd /usr/ports && git pull'
or even a shell function (
sh(1)) for the sake of something easy to type and remember:
Code:
update-ports() {
if cd /usr/ports; then
git pull
cd - >/dev/null # Not sure if this line is necessary, but why take chances?
fi
}
Every tool has its trade-offs. At the very least, git can be faster while offering the same incremental update advantage as svn/svnlite, something that portsnap in its current incarnation just cannot do. Naturally you won't even need to worry about such a thing if you use
poudriere-ports(8) instead of manually updating the repo, but I understand that not everybody wants to use Poudriere.