info-cvs
[Top][All Lists]
Advanced

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

cvs update w/merge+conflict does not exit non-zero


From: Mike Burgun
Subject: cvs update w/merge+conflict does not exit non-zero
Date: Mon, 21 Apr 2003 23:20:54 -0400
User-agent: Mutt/1.4i

Hi fellow CVS'ers,

I believe the following is a bug but I'd like to pass it by the info-cvs
community...

Setup: + I have a file in my sandbox that is locally modified.
       + This file is not up-to-date with respect to the repository.
       + I also happen to know (okay, after the fact, I find out) that
         my edit will conflict with modification(s) already checked
         into the repository.

When merging takes place _and_ conflict(s) are produced during a
"cvs update", cvs currently exits with a zero status versus what I
would expect to be a non-zero status due to the conflict(s).

Example
=======
/tmp> setenv CVSROOT /tmp/CvsRoot
/tmp> cvs init
/tmp> mkdir /tmp/CvsRoot/testdir
/tmp> cvs -Q checkout testdir
/tmp> cd testdir
/tmp/testdir> echo one >number
/tmp/testdir> cvs -Q add -m'number file' number 2>/dev/null
/tmp/testdir> cvs -Q commit -m'one' number >/dev/null
/tmp/testdir> cvs edit number
/tmp/testdir> echo three >number
/tmp/testdir cd ..
/tmp> cvs -Q checkout -d testdir2 testdir
/tmp> cd testdir2
/tmp/testdir2> cvs edit number
/tmp/testdir2> echo two >number
/tmp/testdir2> cvs commit -m'two' number >/dev/null
/tmp/testdir2> cd ../testdir
/tmp/testdir> cvs status number
===================================================================
File: number            Status: Needs Merge

   Working revision:    1.1     Tue Apr 22 02:37:03 2003
   Repository revision: 1.2     /tmp/CvsRoot/testdir/number,v
   Sticky Tag:          (none)
   Sticky Date:         (none)
   Sticky Options:      (none)

/tmp/testdir> cvs update number
RCS file: /tmp/CvsRoot/testdir/number,v
retrieving revision 1.1
retrieving revision 1.2
Merging differences between 1.1 and 1.2 into number
rcsmerge: warning: conflicts during merge
cvs update: conflicts found in number
C number
/tmp/testdir> echo $?
0
/tmp/testdir> cvs update number
C number
/tmp/testdir> echo $?
1
/tmp/testdir> 



PATCH
=====
The following patch/fix ensures that "cvs update" returns a non-zero
exit status when conflict(s) occur...

/tmp/cvs-1.11.5/src> diff -u update.c.orig update.c
--- update.c.orig       Sat Dec 28 13:01:30 2002
+++ update.c    Mon Apr 21 21:18:41 2003
@@ -2114,6 +2114,7 @@
        write_letter (finfo, 'C');
 
        history_write ('C', finfo->update_dir, vers->vn_rcs, finfo->file, 
finfo->repository);
+       retval = 1;
 
     }
     else if (retcode == -1)
@@ -2126,8 +2127,8 @@
        write_letter (finfo, 'M');
        history_write ('G', finfo->update_dir, vers->vn_rcs, finfo->file,
                       finfo->repository);
+       retval = 0;
     }
-    retval = 0;
  out:
     free (backup);
     return retval;
/tmp/cvs-1.11.5/src> 


Thoughts?

Mike Burgun
-- 
------------------------------------------------------------
Michael "Mike" P. Burgun           Synopsys Inc.
Cosmos/Enterprise R&D              1101 Slater Rd
Phone: (919) 425-7305              Brighton Hall, Suite 300
  Fax: (919) 425-7320              Durham, NC 27703
Email: address@hidden    http://www.synopsys.com
------------------------------------------------------------




reply via email to

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