bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SCCS version control cannot cope when latest delta is of type 'remov


From: Kevin Rodgers
Subject: Re: SCCS version control cannot cope when latest delta is of type 'removed'
Date: Fri, 27 Oct 2006 16:02:04 -0600
User-agent: Thunderbird 1.5.0.7 (Windows/20060909)

Chet Wood wrote:
> In the shell using regular sccs commands, or in emacs using C-x C-q,
> check out an sccs-versioned file that has had its latest delta
> removed. Then, in another emacs session, VC commands, such as
> vc-directory or vc-next-action, fail.
>
> When vc-sccs-workfile-version(file) searches for the latest version
> number in the sccs file, it searches for "^Ad D". However, there can
> be another type of delta, namely "^Ad R". In this case, the delta does
> not really exist-- it was removed, leaving this delta entry as a
> "bread crumb" in the sccs file. The search is limited to the first
> delta entry, so it fails and the function returns nil, and as a
> result, a blank version number is passed to vcdiff and it fails.
>
> I tried changing the search to accept [D|R] but it then returns the
> removed delta number, which does not really exist, and other errors
> ensue.
>
> (This scenario happens sometimes when the Sun CodeManager configuration
> management tool is used. It apparently inserts its own bookkeeping
> comments by adding and removing a delta. It seems to happen when a new
> file is added to the workspace, then the workspace is putback to
> another workspace.)
>
> Suggested Fix:
> The search should skip the top delta in the sccs file if it is of type
> "removed", and return the version number of the next delta.
> But IMHO it would be more robust to run the command "sccs
> prt filename" to obtain the version, rather than relying on the
> internal file format, assuming this works on all platforms.

Your second suggestion may be more robust, but since vc-parse-buffer
returns a useful value to vc-sccs-workfile-version, I think we can take
advantage of that to implement a simple fix:

2006-10-27  Kevin Rodgers  <ihs_4664@yahoo.com>

        * vc-sccs.el (vc-sccs-workfile-version): If the top delta entry
          was removed, return the next entry.


*** vc-sccs.el~ 2006-04-22 06:42:26.750000000 -0600
--- vc-sccs.el  2006-10-27 15:53:08.760978700 -0600
***************
*** 144,150 ****
      ;; rather than just the first entry, because the
      ;; first entry might be a deleted ("R") version.
      (vc-insert-file (vc-name file) "^\001e\n\001[^s]")
!     (vc-parse-buffer "^\001d D \\([^ ]+\\)" 1)))

  (defun vc-sccs-checkout-model (file)
    "SCCS-specific version of `vc-checkout-model'."
--- 144,155 ----
      ;; rather than just the first entry, because the
      ;; first entry might be a deleted ("R") version.
      (vc-insert-file (vc-name file) "^\001e\n\001[^s]")
!     (let ((top-delta (save-excursion  ; vc-parse-buffer changes point
!                      (vc-parse-buffer "^\001d \\([DR]\\) \\([^ ]+\\)" 2))))
!       (if (and top-delta
!              (equal (match-string 1) "R")) ; the delta entry was Removed
!         (vc-parse-buffer "^\001d D \\([^ ]+\\)" 1)
!       top-delta))))

  (defun vc-sccs-checkout-model (file)
    "SCCS-specific version of `vc-checkout-model'."

> A workaround is to make a change to the checked-out file (like adding
> a blank line to the end or any other change) and check it back
> in outside of emacs, creating a real latest delta. Then it can be
> checked out again, and should work fine.

--
Kevin





reply via email to

[Prev in Thread] Current Thread [Next in Thread]