From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.bugs Subject: Re: SCCS version control cannot cope when latest delta is of type 'removed' Date: Fri, 27 Oct 2006 16:02:04 -0600 Organization: IHS Message-ID: References: <200610270032.k9R0W8Xc018443@windhorse.sfbay.sun.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1161986654 22301 80.91.229.2 (27 Oct 2006 22:04:14 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 27 Oct 2006 22:04:14 +0000 (UTC) Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Oct 28 00:04:12 2006 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GdZnx-0001G3-SJ for geb-bug-gnu-emacs@m.gmane.org; Sat, 28 Oct 2006 00:03:58 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GdZnx-0003Ml-Is for geb-bug-gnu-emacs@m.gmane.org; Fri, 27 Oct 2006 18:03:57 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GdZnv-0003MI-I7 for bug-gnu-emacs@gnu.org; Fri, 27 Oct 2006 18:03:55 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GdZnu-0003Ly-0i for bug-gnu-emacs@gnu.org; Fri, 27 Oct 2006 18:03:55 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GdZnt-0003Lv-Ui for bug-gnu-emacs@gnu.org; Fri, 27 Oct 2006 18:03:53 -0400 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1GdZnt-00074M-AN for bug-gnu-emacs@gnu.org; Fri, 27 Oct 2006 18:03:53 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1GdZnO-00017z-AE for bug-gnu-emacs@gnu.org; Sat, 28 Oct 2006 00:03:22 +0200 Original-Received: from 207.167.42.206 ([207.167.42.206]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 28 Oct 2006 00:03:22 +0200 Original-Received: from ihs_4664 by 207.167.42.206 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 28 Oct 2006 00:03:22 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-To: bug-gnu-emacs@gnu.org Original-Lines: 73 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: 207.167.42.206 User-Agent: Thunderbird 1.5.0.7 (Windows/20060909) In-Reply-To: <200610270032.k9R0W8Xc018443@windhorse.sfbay.sun.com> X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:15397 Archived-At: 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 * 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