saveb: Save Branch

Description Usage Arguments Details Author(s) See Also Examples

View source: R/revisit.R

Description

Creates a new branch containing the current code in rvenv$currcode.

Usage

1
saveb(bid, desc)

Arguments

bid

Branch id, inserted before the .R extension in the name of the newly-created file.

desc

Description of the branch.

Details

This function creates a new branch file containing the current code in rvenv$currcode. The name of the new file will be created by appending rvenv$currbasenm, '.', the branch id bid, and '.R'. In addtion, the description desc will have '# ' prepended to it and placed before the "# RV history end" line in the file.

For example, file pima.0.R begins with the following lines:

1
2
3
# RV history start
# original code
# RV history end

If the code is changed and then saved with the command saveb(1, "save branch 1"), the newly-created file pima.1.R will begin with the following lines:

1
2
3
4
5
6
7
# RV history start
# original code
# save branch 1
# Time: YYYY-MM-DD Hour:Minute:Second
# Revisited by:
# UserID - Description
# RV history end

If no "# RV history end" line is found in the code being saved (because it was mistakenly edited by the user or for other reasons), the following lines will be prepended to the file in this case:

1
2
3
4
5
6
7
# RV history start
# WARNING: RV history missing and recreated
# save branch 1
# Time: YYYY-MM-DD Hour:Minute:Second
# Revisited by:
# UserID - Description
# RV history end

The new file can then be loaded with the loadb command. For example, suppose that the file pima.0.R is loaded with loadb("pima.0.R"), edited, and then saved with saveb(1, "save branch 1"). That will create file pima.1.R which can later be reloaded with loadb("pima.1.R").

Author(s)

Norm Matloff

See Also

edt
loadb
makebranch0
nxt
runb
rvinit

Examples

1
2
saveb(1, "save branch 1")
saveb(2, "Remove cases with missing data")

matloff/revisit documentation built on May 4, 2019, 4:23 p.m.