]> git.eshelyaron.com Git - emacs.git/commit
VC: CVS: Fix "Root" file parsing
authorOlivier Certner <olce.emacs@certner.fr>
Thu, 6 Apr 2023 08:16:33 +0000 (10:16 +0200)
committerDmitry Gutov <dmitry@gutov.dev>
Wed, 19 Apr 2023 00:47:20 +0000 (03:47 +0300)
commit7a921b6b284a8b5755c61045f4db03f09ff0a386
treeb5e82544c7d3723f381a9fa2cc57f7f4ccf541a7
parent9093834d0b590bc15ed994bd62f18f7b47a48f55
VC: CVS: Fix "Root" file parsing

The new "Root" file parsing has been based on CVS' documentation,
which gives the following format for *remote* repositories:
[:method:][[user][:password]@]hostname[:[port]]/pathname/to/repository
and for local ones:
:local:/pathname/to/repository
or
:local:c:/pathname/to/repository
or alternatively ':local:' replaced by ':fork:', or ':local:' omitted
when the path starts with a slash.

[The actual parsing code in CVS is actually a bit more restrictive.
See 'root.c'.]

Most notably, the previous version could not parse an absolute
pathname without an explicit :local: method or :pserver: lines with
passwords.

* lisp/vc/vc-cvs.el (vc-cvs-parse-root): Rewrite.

(vc-cvs-repository-hostname): Cope with `vc-cvs-parse-root' returning
an empty hostname (can only happen if the "Root" file is invalid),
returning nil in this case.

(vc-cvs-parse-uhp): Remove this standalone function formerly used only
by `vc-cvs-parse-root' and which doesn't allow correct parsing anyway.

* test/lisp/vc/vc-cvs-tests.el: New file, with tests for common "Root"
file content.
lisp/vc/vc-cvs.el
test/lisp/vc/vc-cvs-tests.el [new file with mode: 0644]