···20202121 `$ ruby openbsd-commitid.rb`
22222323-**NOTE**: `rlog` in path must be modified to end revisions with `[...]---###`,
2424-not just a line of dashes since those appear in some commit messages. This
2525-allows the script to accurately separate each revision from `rlog`. This
2626-change will not be committed, and is included as a patch here.
2323+**NOTE**: `rlog` in path must be modified to separate revisions and files
2424+with an arbitrary delimiter, not just a line of dashes since those appear in
2525+some commit messages. This allows the script to accurately separate each
2626+revision from `rlog`. This change might be committed, but is included here
2727+as a patch for now.
27282829**NOTE**: This script relies on a newly added `-C` flag to `cvs admin`, which
2930sets a `commitid` in an RCS file. This change has not yet been committed and
···45463. Fetch all revisions not already matched to a changeset, ordered by author
4647then date, and bundle them into changesets. Create a new "changesets" record
4748for each, then update each of those "revisions" records with the new changeset
4848-id. By sorting all commits by author name, it's possible to accurately find
4949-all files touched by an author in the same commit window.
4949+id. By sorting all commits by author and date, it's possible to accurately
5050+find all files touched by an author in the same commit window.
505151524. For each newly created "changesets" record, update them with a definitive
5253timestamp, log message, author, and commitid (creating a new one if needed)
+6-5
lib/rcsfile.rb
···11class RCSFile
22 attr_accessor :revisions, :first_undead_version
3344+ RCSEND = "==================OPENBSD_COMMITID_RCS_END=================="
55+ REVSEP = "------------------OPENBSD_COMMITID_REV_SEP------------------"
66+47 def initialize(file)
58 @revisions = {}
6977- # rcs modified to end revs in ###
810 blocks = []
99- IO.popen([ "rlog", file ]) do |rlog|
1010- # rlog modified to end revision and file separators with ###
1111+ IO.popen([ "rlog", "-E#{RCSEND}", "-S#{REVSEP}", file ]) do |rlog|
1112 blocks = rlog.read.force_encoding("binary").
1212- split(/^(-{28}|={77})###\n?$/).
1313- reject{|b| b.match(/\A(-{28}|={77})\z/) }
1313+ split(/^(#{REVSEP}|#{RCSEND})\n?$/).
1414+ reject{|b| b == RCSEND || b == REVSEP }
1415 end
15161617 if !blocks.first.match(/^RCS file/)
+117-14
patches/patch-rcs_rlog_revsep.diff
···11-# change revision separator to something unique, since all dashes appear inside
22-# of some existing commit messages, making it impossible to accurately parse
33-# rlog output
11+# add -E and -S flags to rlog to allow changing RCS end and revision separators
22+# to something non-standard, since lines of all dashes appear inside of some
33+# existing commit messages, making it impossible to accurately parse rlog
44+# output
45#
55-# not to be committed
66+# might be committed
6788+Index: usr.bin/rcs/rlog.1
99+===================================================================
1010+RCS file: /var/cvs/src/usr.bin/rcs/rlog.1,v
1111+retrieving revision 1.24
1212+diff -u -p -u -p -r1.24 rlog.1
1313+--- usr.bin/rcs/rlog.1 3 Sep 2010 11:09:29 -0000 1.24
1414++++ usr.bin/rcs/rlog.1 21 Jan 2016 20:27:27 -0000
1515+@@ -24,8 +24,10 @@
1616+ .Nm
1717+ .Op Fl bhLNRtV
1818+ .Op Fl d Ns Ar dates
1919++.Op Fl E Ns Ar endsep
2020+ .Op Fl l Ns Op Ar lockers
2121+ .Op Fl r Ns Op Ar revs
2222++.Op Fl S Ns Ar revsep
2323+ .Op Fl s Ns Ar states
2424+ .Op Fl w Ns Op Ar logins
2525+ .Op Fl x Ns Ar suffixes
2626+@@ -82,6 +84,11 @@ character.
2727+ See also the
2828+ .Fl z
2929+ option, below.
3030++.It Fl E Ns Ar endsep
3131++Print
3232++.Ar endsep
3333++at the end of each RCS file, instead of the default string of
3434++77 equal signs.
3535+ .It Fl h
3636+ Print the RCS header,
3737+ describing a file's branch, lock details, symbolic names, etc.
3838+@@ -131,6 +138,11 @@ and
3939+ Without argument, the
4040+ .Fl r
4141+ option means the latest revision of the default branch.
4242++.It Fl S Ns Ar revsep
4343++Print
4444++.Ar revsep
4545++at the end of each RCS revision, instead of the default string of
4646++28 dash signs.
4747+ .It Fl s Ns Ar states
4848+ Print information about revisions whose state matches one of the
4949+ specified
750Index: usr.bin/rcs/rlog.c
851===================================================================
99-RCS file: /cvs/src/usr.bin/rcs/rlog.c,v
1010-retrieving revision 1.67
1111-diff -u -p -u -p -r1.67 rlog.c
1212---- usr.bin/rcs/rlog.c 7 Jan 2014 14:08:16 -0000 1.67
1313-+++ usr.bin/rcs/rlog.c 6 Aug 2014 23:38:02 -0000
1414-@@ -47,9 +47,9 @@ static void rlog_file(const char *, RCSF
5252+RCS file: /var/cvs/src/usr.bin/rcs/rlog.c,v
5353+retrieving revision 1.71
5454+diff -u -p -u -p -r1.71 rlog.c
5555+--- usr.bin/rcs/rlog.c 16 Jan 2015 06:40:11 -0000 1.71
5656++++ usr.bin/rcs/rlog.c 21 Jan 2016 20:29:26 -0000
5757+@@ -46,10 +46,7 @@ static int rlog_select_daterev(RCSFILE *
5858+ static void rlog_file(const char *, RCSFILE *);
1559 static void rlog_rev_print(struct rcs_delta *);
16601717- #define RLOG_OPTSTRING "d:hLl::NqRr::s:TtVw::x::z::"
6161+-#define RLOG_OPTSTRING "d:hLl::NqRr::s:TtVw::x::z::"
1862-#define REVSEP "----------------------------"
1919-+#define REVSEP "----------------------------###"
2020- #define REVEND \
6363+-#define REVEND \
2164- "============================================================================="
2222-+ "=============================================================================###"
6565++#define RLOG_OPTSTRING "d:E:hLl::NqRr::S:s:TtVw::x::z::"
23662467 static int dflag, hflag, Lflag, lflag, rflag, tflag, Nflag, wflag;
2568 static char *llist = NULL;
6969+@@ -57,14 +54,18 @@ static char *slist = NULL;
7070+ static char *wlist = NULL;
7171+ static char *revisions = NULL;
7272+ static char *rlog_dates = NULL;
7373++static char *revsep = "----------------------------";
7474++static char *revend = "====================================================="
7575++ "========================";
7676+7777+ __dead void
7878+ rlog_usage(void)
7979+ {
8080+ fprintf(stderr,
8181+- "usage: rlog [-bhLNRtV] [-ddates] [-l[lockers]] [-r[revs]]\n"
8282+- " [-sstates] [-w[logins]] [-xsuffixes]\n"
8383+- " [-ztz] file ...\n");
8484++ "usage: rlog [-bhLNRtV] [-ddates] [-Eendsep] [-l[lockers]] "
8585++ "[-r[revs]]\n"
8686++ " [-Srevsep] [-sstates] [-w[logins]] [-xsuffixes] "
8787++ "[-ztz] file ...\n");
8888+8989+ exit(1);
9090+ }
9191+@@ -85,6 +86,9 @@ rlog_main(int argc, char **argv)
9292+ dflag = 1;
9393+ rlog_dates = rcs_optarg;
9494+ break;
9595++ case 'E':
9696++ revend = rcs_optarg;
9797++ break;
9898+ case 'h':
9999+ hflag = 1;
100100+ break;
101101+@@ -110,6 +114,9 @@ rlog_main(int argc, char **argv)
102102+ rflag = 1;
103103+ revisions = rcs_optarg;
104104+ break;
105105++ case 'S':
106106++ revsep = rcs_optarg;
107107++ break;
108108+ case 's':
109109+ slist = rcs_optarg;
110110+ break;
111111+@@ -420,7 +427,7 @@ rlog_file(const char *fname, RCSFILE *fi
112112+ }
113113+ }
114114+115115+- printf("%s\n", REVEND);
116116++ printf("%s\n", revend);
117117+ }
118118+119119+ static void
120120+@@ -501,7 +508,7 @@ rlog_rev_print(struct rcs_delta *rdp)
121121+ (slist != NULL || lflag == 1 || wflag == 1)) && found == 0))
122122+ return;
123123+124124+- printf("%s\n", REVSEP);
125125++ printf("%s\n", revsep);
126126+127127+ rcsnum_tostr(rdp->rd_num, numb, sizeof(numb));
128128+