Subject: Re: bug#4179: vc-merge with svn: syntax error in revision arg.

From: Lars Ingebrigtsen <[email-masked]>
Date: Fri, 27 Aug 2021 05:06:50 +0200

Dan Nicolaescu <[email-masked]> writes:

> We have this code in `vc-merge'
>
>     (if (string= first-revision "")
>         (setq status (vc-call-backend backend 'merge-news file))
>       (if (not (vc-find-backend-function backend 'merge))
>         (error "Sorry, merging is not implemented for %s" backend)
>         (if (not (vc-branch-p first-revision))
>             (setq second-revision
>                     (read-string "Second revision: "
>                          (concat (vc-branch-part first-revision) ".")))
>            ;; We want to merge an entire branch.  Set revisions
>            ;; accordingly, so that vc-BACKEND-merge understands us.
>            (setq second-revision first-revision)
>            ;; first-revision must be the starting point of the branch
>           (setq first-revision (vc-branch-part first-revision)))
>
> `vc-branch-p' can be made VC backend specific.
> But what should we do with `vc-branch-part'?
> What should be the new structure of this code?

(I'm going through old bug reports that unfortunately weren't
resolved at the time.)

This code has changed a lot in the 12 years since this was discussed --
does anybody know whether the originally reported problem has been fixed
or not?

Also:

;; functions that operate on RCS revision numbers.  This code should
;; also be moved into the backends.  It stays for now, however, since
;; it is used in code below.
(defun vc-branch-p (rev)
  "Return t if REV is a branch revision."
  (not (eq nil (string-match "\\`[0-9]+\\(\\.[0-9]+\\.[0-9]+\\)*\\'" rev))))

;;;###autoload
(defun vc-branch-part (rev)
  "Return the branch part of a revision number REV."
  (let ((index (string-match "\\.[0-9]+\\'" rev)))
    (when index
      (substring rev 0 index))))

The comment there is wrong -- it's no longer used in vc.el.  Perhaps
these two functions should be moved to vc-rcs.el (and renamed (with
obsolete aliases))?   (They're only used in vc-rcs.el and vc-vcs.el.)

I've added Dmitry to the CCs; perhaps he has some comments.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no