rcs-fast-export
13 years agoAtomic merges
Giuseppe Bilotta [Sun, 25 Jul 2010 15:53:11 +0000 (17:53 +0200)] 
Atomic merges

Move the tree-merging method to Tree, and make it atomic: if merging
fails, the tree is not updated. Since the error propagates up, and the
tree merge is the first step of a commit merge, commit merges are atomic
too.

13 years agoSkip unhandled commands correctly
Giuseppe Bilotta [Mon, 28 Jun 2010 14:20:05 +0000 (16:20 +0200)] 
Skip unhandled commands correctly

Commands such as access can be multi-line, so keep skipping until we come
across the terminating semicolon.

13 years agoFixed bug when binary file changed in RCS.
Ben Martin [Mon, 21 Jun 2010 14:13:17 +0000 (10:13 -0400)] 
Fixed bug when binary file changed in RCS.

If the RCS file being tracked is missing a final new-line character, the
program would crash whenever the last line was deleted and then added.

Reproduction steps:

mkdir /tmp/bug_demo && cd /tmp/bug_demo
rcs -i foo.txt
echo -n "foo" > foo.txt
ci foo.txt
co -l foo.txt
echo -n "d" >> foo.txt
ci foo.txt
git init
~/bin/rcs-fast-export.rb foo.txt,v

13 years agoAdded 'expand' to the list of known but unhandled RCS commands.
Ben Martin [Mon, 21 Jun 2010 14:08:49 +0000 (10:08 -0400)] 
Added 'expand' to the list of known but unhandled RCS commands.

14 years agoProper file modes
Giuseppe Bilotta [Tue, 13 Apr 2010 21:21:38 +0000 (23:21 +0200)] 
Proper file modes

14 years agoPreliminary support for full-repo export
Giuseppe Bilotta [Tue, 13 Apr 2010 21:15:38 +0000 (23:15 +0200)] 
Preliminary support for full-repo export

14 years agoImprove parsing
Giuseppe Bilotta [Tue, 13 Apr 2010 08:58:55 +0000 (10:58 +0200)] 
Improve parsing

Some (older?) RCS files have a more lax syntax (e.g. symbols in the same line
as the symbols command itself, multiple symbols per line, etc). Handle this
situation, and take the change to give the parser an overall cleaner approach.
In particular, tell apart unsupported (skipped) commands from unknown ones (abort).

14 years agoImport entire directories
Giuseppe Bilotta [Wed, 12 Aug 2009 09:31:16 +0000 (11:31 +0200)] 
Import entire directories

It is now possible to specify directories instead of files, in which
case the directory structure is descended, importing all RCS-tracked
files, considered with their path relative to the specified directory.

Feature suggested in private communication by David Kettler.

14 years agoOption to prepend filenames to commit logs
Giuseppe Bilotta [Wed, 12 Aug 2009 08:27:46 +0000 (10:27 +0200)] 
Option to prepend filenames to commit logs

Feature suggested in private comunication by David Kettler.

15 years agoSuppress two more warnings
Giuseppe Bilotta [Sat, 4 Apr 2009 09:20:40 +0000 (11:20 +0200)] 
Suppress two more warnings

* parenthesize an Array explosion
* define :date as an attribute reader since we're going to define the
  :date= writer ourselves

15 years agoFix warning about missing parens around arg
Ben Jackson [Fri, 3 Apr 2009 22:20:48 +0000 (15:20 -0700)] 
Fix warning about missing parens around arg

15 years agoBackport Integer#odd? to older Ruby versions
Giuseppe Bilotta [Sat, 4 Apr 2009 08:47:24 +0000 (10:47 +0200)] 
Backport Integer#odd? to older Ruby versions

As pointed out by a private communication from Ben Jackson, Integer#odd?
was introduced in Ruby 1.8.7; to make the script runnable on older Ruby
versions, we define the method ourselves if it's missing.

15 years agoFix diff index handling
Giuseppe Bilotta [Sat, 28 Mar 2009 00:05:04 +0000 (01:05 +0100)] 
Fix diff index handling

Inserting text at index 0 (a0 N command, to prepend N lines) resulted in
text being appended since the diff index 0 was mapped to Ruby index -1.
The solution is to turn insertions into Array#unshift rather than
Array#<<, so that they can use the same index as the diff, and only
decrementing the diff index for deletions.

15 years agoBuild buffer as an array of arrays
Giuseppe Bilotta [Fri, 27 Mar 2009 23:44:11 +0000 (00:44 +0100)] 
Build buffer as an array of arrays

Sanitizing the buffer by splitting buffer entries at newlines causes the
newlines to disappear. A much cleaner solution, which doesn't have this
serious bug, is to turn the buffer into a buffer of arrays of strings,
to be flattened right before the final assignment.

15 years agosanitize buffer after ranges of additions
Giuseppe Bilotta [Thu, 26 Mar 2009 07:52:32 +0000 (08:52 +0100)] 
sanitize buffer after ranges of additions

When adding a range of lines, they would be added as a single string
with embedded newlines so as to preserve line indices for subsequent
insertions/deletions. However, such lines need to be split before
loading them into the next revision text buffer, to ensure that
revisions using the new one as diff base find the correct lines.

15 years agoExport all branches for each revision
Giuseppe Bilotta [Thu, 26 Mar 2009 00:34:41 +0000 (01:34 +0100)] 
Export all branches for each revision

15 years agoHandle symbolic heads
Giuseppe Bilotta [Thu, 26 Mar 2009 00:27:51 +0000 (01:27 +0100)] 
Handle symbolic heads

RCS files can contain symbols that don't point to an actual commit;
checking out these symbols retrieves the highest revision with matching
major numbers. Fo example, with symbol SYM:3 and revisions 2.1, 3.1,
3.2, 4.1, checking out SYM results in 3.2 being checked out.

This feature translates pretty straightforwardly to git heads. These
symbols are detected by their missing date and are deleted after
assigning their name as branch to the appropriate revision.

15 years agoTry to guess the user's name and email
Giuseppe Bilotta [Tue, 18 Nov 2008 00:00:14 +0000 (01:00 +0100)] 
Try to guess the user's name and email

A common use case for RCS fast export is likely to be of a user trying to
convert its RCS histories into git histories. In these cases we don't need an
authors file, since the committer full name and email are information likely
to be found elsewhere.

We look at the git config, but also the gecos entry in the passwd file. As
extreme resources we also peek in their .hgrc and .vimrc files

15 years agoDocument config options in usage
Giuseppe Bilotta [Mon, 17 Nov 2008 22:17:10 +0000 (23:17 +0100)] 
Document config options in usage

15 years agoAlso read config option rcs.tageachrev
Giuseppe Bilotta [Mon, 17 Nov 2008 22:15:23 +0000 (23:15 +0100)] 
Also read config option rcs.tageachrev

15 years agoConfig before command line
Giuseppe Bilotta [Mon, 17 Nov 2008 22:12:12 +0000 (23:12 +0100)] 
Config before command line

15 years agoImprove usage
Giuseppe Bilotta [Mon, 17 Nov 2008 22:09:43 +0000 (23:09 +0100)] 
Improve usage

15 years agoExpand authorsfile path
Giuseppe Bilotta [Mon, 17 Nov 2008 21:59:28 +0000 (22:59 +0100)] 
Expand authorsfile path

15 years agoAlso read config option rcs.authorsfile
Giuseppe Bilotta [Mon, 17 Nov 2008 21:58:59 +0000 (22:58 +0100)] 
Also read config option rcs.authorsfile

15 years agoImplement --authors-file option
Giuseppe Bilotta [Mon, 17 Nov 2008 21:45:03 +0000 (22:45 +0100)] 
Implement --authors-file option

15 years agoImplement --tag-each-rev option
Giuseppe Bilotta [Mon, 17 Nov 2008 21:32:01 +0000 (22:32 +0100)] 
Implement --tag-each-rev option

15 years agoOptions infrastructure
Giuseppe Bilotta [Mon, 17 Nov 2008 20:51:50 +0000 (21:51 +0100)] 
Options infrastructure

15 years agoImport RCS symbols as lightweight git tags
Giuseppe Bilotta [Mon, 17 Nov 2008 19:47:07 +0000 (20:47 +0100)] 
Import RCS symbols as lightweight git tags

15 years agoFix branch names
Giuseppe Bilotta [Mon, 17 Nov 2008 18:35:13 +0000 (19:35 +0100)] 
Fix branch names

15 years agoInitial commit
Giuseppe Bilotta [Sat, 15 Nov 2008 02:11:31 +0000 (03:11 +0100)] 
Initial commit