@matheusbsbs / matheus-bagliano / commits / 02f3389d96
Fork 0

Moved from command to after data to help cvs2svn.

cvs2svn has three phases: begin_commit, middle_commit, end_commit. The ancester is computed in the middle_commit phase. So its easier to generate a stream if the from command appears after the commit message itself but before the file change commands. Signed-off-by: Shawn O. Pearce <spearce@spearce.org>

Shawn O. Pearce committed Aug 24, 2006 at 22:38 UTC 02f3389d9647378ed864ff1cdfb6f0238b64ee91
1 file changed +4 -3
fast-import.c
+4 -3
@@ -14,11 +14,11 @@ Format of STDIN stream:
14 file_content ::= data;
15
16 new_commit ::= 'commit' sp ref_str lf
17 - ('from' sp (ref_str | hexsha1 | sha1exp_str | idnum) lf)?
17 mark?
18 ('author' sp name '<' email '>' ts tz lf)?
19 'committer' sp name '<' email '>' ts tz lf
20 commit_msg
21 + ('from' sp (ref_str | hexsha1 | sha1exp_str | idnum) lf)?
22 file_change*
23 lf;
24 commit_msg ::= data;
@@ -1385,7 +1385,6 @@ static void cmd_new_commit()
1385 free(str_uq);
1386
1387 read_next_command();
1388 - cmd_from(b);
1388 cmd_mark();
1389 if (!strncmp("author ", command_buf.buf, 7)) {
1390 author = strdup(command_buf.buf);
@@ -1398,6 +1397,8 @@ static void cmd_new_commit()
1397 if (!committer)
1398 die("Expected committer but didn't get one");
1399 msg = cmd_data(&msglen);
1400 + read_next_command();
1401 + cmd_from(b);
1402
1403 /* ensure the branch is active/loaded */
1404 if (!b->branch_tree.tree || !max_active_branches) {
@@ -1407,7 +1408,6 @@ static void cmd_new_commit()
1408
1409 /* file_change* */
1410 for (;;) {
1410 - read_next_command();
1411 if (1 == command_buf.len)
1412 break;
1413 else if (!strncmp("M ", command_buf.buf, 2))
@@ -1416,6 +1416,7 @@ static void cmd_new_commit()
1416 file_change_d(b);
1417 else
1418 die("Unsupported file_change: %s", command_buf.buf);
1419 + read_next_command();
1420 }
1421
1422 /* build the tree and the commit */