info-cvs
[Top][All Lists]
Advanced

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

Re: Fw: checkout a old version file to cover the new one-SOLOVED


From: Russ Sherk
Subject: Re: Fw: checkout a old version file to cover the new one-SOLOVED
Date: Mon, 29 Aug 2005 08:04:47 -0400

On 8/28/05, xiangbin <address@hidden> wrote:
> Hi,all
> What I really want is  to replace the contents of main.c with the contents
>  it had at 1.1.1.1 and DO NOT change the version(keep it 1.2) .
With CVS it is not possible to change history.  Also, it is not a good
idea to think about file revisions in terms of version numbers. 
However, it is possible to 'work around' the issue.  There are 2
possible start states for your situation.

1. main.c v1.2 is at the tip of the trunk.  This is good; you don't
have to change history..  Just cvs up -A main.c; cvs up -j1.1.1.1
main.c; cvs ci -m "Replacing 1.2 with 1.1.1.1." main.c.  This is how
cvs is supposed to work.

2. main.c v1.2 is not at the tip of the trunk ( e.g. main.c -> 1.1 ->
1.2 -> 1.3).  This is where you have to change history.  Basically in
english this means "I want to replace main.c v1.2 with main.c v1.1.1.1
without disturbing the main trunk.  (So 1.3 and child revisions will
not be affected.)  In this case, I see no other way but to create a
branch for main.c, update it with 1.1.1.1 and reference it with a tag.
 (Please note, this is a kludge and is not straightforward to
implement but will achieve what you want.)
----
cvs rtag -b -r1.2 BR_1_2 main.c
cvs co -rBR_1_2 main.c
cvs co -p -r1.1.1.1 main.c > main.c
cvs ci -m "Replacing main.c 1.2 with 1.1.1.1 without disturbing the
main trunk." main.c
cvs rtag -rBR_1_2 NEW_1_2 main.c
# To include the new revision in a build from a tag:
cvs rtag MY_BUILD_TAG <other source code from main trunk>
cvs rtag -F -r NEW_1_2 MY_BUILD_TAG main.c
# The disadvantage here is that you must remember to tag this revision
each time.
----

Can you explain why you want to replace the version like that?

--Russ

>  The following
>  command:
>  $cvs up -r1.1.1.1 -C main.c
>  only checkout the 1.1.1.1 version and when I modifed it and do commit:
>  ------------------
>  $cvs commit
>  cvs commit: Examining .
>  cvs commit: sticky tag `1.1.1.1' for file `main.c' is not a branch
> cvs [commit aborted]: correct above errors first!
>  ----------------------------------
> As you see,that's not what I want .
> Finally,thanks for Todd,by
> cvs update -j1.1.1.1 main.c
> really achieves my goals .
> 
>  -Xiangbin
> 
> > ----- Original Message -----
> > From: "Todd Denniston" <address@hidden>
> > To: "xiangbin" <address@hidden>
> > Cc: <address@hidden>
> > Sent: Friday, August 26, 2005 9:31 PM
> > Subject: Re: checkout a old version file to cover the new one
> >
> >
> >> xiangbin wrote:
> >>>
> >>> Hi,
> >>> I am new user to CVS. When I work with the newest version, I
> >>> suddenly found I need the old version of a file, say,main.c of version
> >>> 1.1.1.1 .I know that I can checkout the whole version of 1.1.1.1 in
> >>> another
> >>> directory,then copy....But,if there is any way to achieve this just by
> >>> checkout the old file and cover the local one ?
> >>
> >> in the sandbox directory where main.c normally exists do:
> >>
> >> cvs checkout -p -r1.1.1.1 main.c > main_1.1.1.1.c
> >>
> >> -p      Check out files to standard output (avoids stickiness).
> >>
> >> but lets clarify one point ... you say "and cover the local one", do you
> >> mean you want to replace the contents of main.c (our example file) in
> >> your
> >> sandbox with the contents it had at 1.1.1.1 (our example rev), perhaps
> >> because you want to undo all the changes since 1.1.1.1?
> >>
> >> I think that could be accomplished by either
> >> cvs update -j1.1.1.1 main.c
> >> or
> >> cvs checkout -jcurrentRev -j1.1.1.1 main.c
> >>
> >> --
> >> Todd Denniston
> >> Crane Division, Naval Surface Warfare Center (NSWC Crane)
> >> Harnessing the Power of Technology for the Warfighter
> >
> >
> 
> 
> 
> _______________________________________________
> Info-cvs mailing list
> address@hidden
> http://lists.nongnu.org/mailman/listinfo/info-cvs
>




reply via email to

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