Fix importing of branches into RCS
Fix importing of branches into RCS

RCS requires the parent revision to be locked to checkin a new revision.
When there is only a single branch everything works, but when jumping to
a different branch `ci' fails reporting the parent revision on this
branch isn't locked.

Remember the previous revision, which is locked in RCS, for every
checked in file.  If the parent of the revision being checked in is not
the previously checked in revision then unlock the locked revision and
relock the parent revision.

Test case:

$ cat test-04-branches.fastexp
commit refs/heads/master
mark :1
committer Joe Bloggs <joe.bloggs@example.com> 999091736 +0100
data 13
Add file.txt

M 644 inline file.txt
data 51
Contents of file.txt, changeset 1/3, branch master

commit refs/heads/b1
mark :2
committer Joe Bloggs <joe.bloggs@example.com> 999098479 +0100
data 29
Update file.txt on branch b1

from :1
M 644 inline file.txt
data 47
Contents of file.txt, changeset 2/3, branch b1

commit refs/heads/master
mark :3
committer Joe Bloggs <joe.bloggs@example.com> 999098479 +0100
data 33
Update file.txt on branch master

from :1
M 644 inline file.txt
data 51
Contents of file.txt, changeset 3/3, branch master

$ rcs-fast-import -v -v -v < test-04-branches.fastexp
rcs-fast-import: repository fast import creates
/tmp/test/.rs2845
rcs-fast-import:......(0.00 sec) done.
commit refs/heads/master
rcs-fast-import:    :1 M file.txt
rcs-fast-import: linking ../.rs2845/inline-156562380 to file.txt
Assigning 1.1 to file.txt
rcs-fast-import: executing 'ci -l1.1 -d'Wed 29 Aug 2001 14:28:56 +0100'
-m'Committer: Joe Bloggs <joe.bloggs@example.com>
Committer-Date: Wed 29 Aug 2001 14:28:56 +0100
Mark: :1

Add file.txt
' file.txt RCS/file.txt,v' modify
RCS/file.txt,v  <--  file.txt
initial revision: 1.1
done
rcs-fast-import: removing file.txt
commit refs/heads/b1
rcs-fast-import:    :2 M file.txt
rcs-fast-import: linking ../.rs2845/inline-156562924 to file.txt
Assigning 1.1.1.1 to file.txt
rcs-fast-import: executing 'ci -l1.1.1.1 -d'Wed 29 Aug 2001 16:21:19
+0100' -m'Committer: Joe Bloggs <joe.bloggs@example.com>
Committer-Date: Wed 29 Aug 2001 16:21:19 +0100
Mark: :2
Parents: :1

Update file.txt on branch b1
' file.txt RCS/file.txt,v' modify
RCS/file.txt,v  <--  file.txt
new revision: 1.1.1.1; previous revision: 1.1
done
rcs-fast-import: removing file.txt
rcs-fast-import: executing 'rcs -N'refs/heads/b1':1.1.1 RCS/file.txt,v'
RCS file: RCS/file.txt,v
done
commit refs/heads/master
rcs-fast-import:    :3 M file.txt
rcs-fast-import: linking ../.rs2845/inline-156563340 to file.txt
Assigning 1.2 to file.txt
rcs-fast-import: executing 'ci -l1.2 -d'Wed 29 Aug 2001 16:21:19 +0100'
-m'Committer: Joe Bloggs <joe.bloggs@example.com>
Committer-Date: Wed 29 Aug 2001 16:21:19 +0100
Mark: :3
Parents: :1

Update file.txt on branch master
' file.txt RCS/file.txt,v' modify
RCS/file.txt,v  <--  file.txt
ci: RCS/file.txt,v: no lock set by mike for revision 1.1
cleaning up......(0.00 sec) done.
rcs-fast-import: cleaning up
/tmp/test/.rs2845......(0.00 sec)
done.
rcs-fast-import: child returned 1.

mfleetwo/rcs-fast-import