[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] always treat locally-added files as Modified
From: |
Ed Santiago |
Subject: |
[PATCH] always treat locally-added files as Modified |
Date: |
Fri, 13 May 2005 14:57:45 -0600 |
This patches a very obscure condition involving a merge followed
by toggling the CVS/Root file followed by diff -N. Patch is
against current (13 May 2005) cvs HEAD.
I grant permission to distribute this patch under the terms of
the GNU Public License.
=====
SETUP
=====
* File 'file1' has been added on branch B between tags T1 and T2
* Merge T1-T2 via cvs -d /local/repo co -jT1 -jT2 mydir
(it is important to check out from a local directory, not remote)
* Hand-update CVS/Root to :fork:/local/repo or <host>:/remote/repo
(or just add "-d <new-repo>" to CVS command line)
* try to get diffs: cd mydir && cvs diff -N file1
Depending on the version of CVS, the diff will fail with:
cvs server: extra operand
cvs server: Try `diff --help' for more information.
or:
cvs [diff aborted]: could not get info for `file1': No such file or
directory
========
ANALYSIS
========
When checking out from a remote (server) repository, CVS/Entries
gets "dummy timestamp" for file1. That's good. When checking
out from a local repository, CVS/Entries gets a genuine timestamp.
Not so good.
When running diff, CVS client.c compares the timestamp and decides
that file1 is unchanged... and sends "Unchanged file1" to the
server. I haven't chased down why exactly this matters, but
it does cause the server to choke.
========
SOLUTION
========
src/client.c : always treat a locally-added file (vn_user=="0")
as modified.
This may not be the best solution. It may also be desirable
to set CVS/Entries timestamp to "dummy timestamp" when checking
out locally; and/or to track down the server code that has
trouble with "Unchanged". This solution has the benefit of
being simple to code, simple to test, and not breaking sanity.
It also seems like a proper thing for the code to do.
--
Ed Santiago Toolsmith esm@edsantiago.com
Index: src/ChangeLog
===================================================================
RCS file: /cvs/ccvs/src/ChangeLog,v
retrieving revision 1.3191
diff -u -r1.3191 ChangeLog
--- src/ChangeLog 11 May 2005 20:01:47 -0000 1.3191
+++ src/ChangeLog 13 May 2005 19:39:57 -0000
@@ -1,3 +1,7 @@
+2005-05-13 Eduardo Santiago <esm@edsantiago.com>
+
+ * client.c (send_fileproc): Treat locally-added file as Is-modified.
+
2005-05-11 Derek Price <derek@ximbiot.com>
* cvs.h (find_files): New proto.
Index: src/client.c
===================================================================
RCS file: /cvs/ccvs/src/client.c,v
retrieving revision 1.423
diff -u -r1.423 client.c
--- src/client.c 22 Mar 2005 13:19:57 -0000 1.423
+++ src/client.c 13 May 2005 19:06:27 -0000
@@ -4461,6 +4461,7 @@
}
else if (vers->ts_rcs == NULL
|| args->force
+ || (vers->vn_user && vers->vn_user[0] == '0') /* Locally added? */
|| strcmp (vers->ts_user, vers->ts_rcs) != 0)
{
if (args->no_contents
Index: src/sanity.sh
===================================================================
RCS file: /cvs/ccvs/src/sanity.sh,v
retrieving revision 1.1061
diff -u -r1.1061 sanity.sh
--- src/sanity.sh 11 May 2005 20:01:47 -0000 1.1061
+++ src/sanity.sh 13 May 2005 19:06:55 -0000
@@ -10113,6 +10113,34 @@
R file3
R file4'
+ # 2005 May 13: obscure effect of:
+ #
+ # cvs {checkout|update} -j... -j... [brings in file1 as 'A'dded]
+ #
+ # CVS/Entries gets a different result depending on whether
+ # the checkout/update was done *locally* or *via server*:
+ #
+ # local : /file1/0/Fri May 13 17:36:18 2005//
+ # server : /file1/0/dummy timestamp//
+ #
+ # Normally not a problem. But if the checkout is local, and
+ # CVS/Root is subsequently changed to server (as typically
+ # happens in replicated CVS mirror situations), 'cvs diff -N file1'
+ # barfs with:
+ #
+ # cvs [diff aborted]: could not get info for `file1': No such file or
directory
+ #
+ if $remote; then :; else
+ dotest_fail join-xx "${testcvs} -d :fork:${CVSROOT} diff -N
file1" \
+'Index: file1
+===================================================================
+RCS file: file1
+diff -N file1
+0a1
+> first branch revision of file1'
+ fi
+
+
# Modify file4 locally, and do an update with a merge.
cd ../../1/first-dir
echo 'third revision of file4' > file4
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] always treat locally-added files as Modified,
Ed Santiago <=