From: Ramkumar Ramachandra <artagnon@gmail.com>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Git List <git@vger.kernel.org>,
David Barr <david.barr@cordelta.com>,
Sverre Rabbelier <srabbelier@gmail.com>,
Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH 3/3] vcs-svn: Refactor dump_export code into dispatch table
Date: Wed, 2 Feb 2011 08:26:31 +0530 [thread overview]
Message-ID: <20110202025626.GC11339@kytes> (raw)
In-Reply-To: <20110201174241.GB3771@burratino>
Hi Jonathan,
Jonathan Nieder writes:
> Ramkumar Ramachandra wrote:
>
> > +++ b/vcs-svn/dump_export.c
> > @@ -11,6 +11,48 @@
> [...]
> > +static state_fn *const dispatch_table[NODE_KIND_COUNT][NODE_ACTION_COUNT] = {
> > + /* NODE_KIND_UNKNOWN */
> > + {abort, abort, abort, Adelete, abort},
> > + /* NODE_KIND_NORMAL */
> > + {abort, Nchange, Nadd, Adelete, Nreplace},
> > + /* NODE_KIND_EXECUTABLE */
> > + {abort, Echange, Eadd, Adelete, Ereplace},
> > + /* NODE_KIND_SYMLINK */
> > + {abort, Schange, Sadd, Adelete, Sreplace},
> > + /* NODE_KIND_GITLINK */
> > + {abort, abort, abort, abort, abort},
> > + /* NODE_KIND_DIR */
> > + {abort, Dchange, Dadd, Adelete, Dreplace},
> > + /* NODE_KIND_SUBDIR */
> > + {abort, abort, abort, abort, abort}
> > +};
>
> Heh. I think that Junio was suggesting making the _parser_
> table-driven, meaning something like
Oops :p I'll fix this in the next round.
> ... node_kinds[] = {
> { "100644", sizeof("100644"), "file" },
> { "100755", sizeof("100755"), "file", "svn:executable" },
> { "120000", sizeof("120000"), "file", "svn:special" },
> { "160000", sizeof("160000"), "file" }, /* NEEDSWORK: seems wrong" */
> { "040000", sizeof("040000"), "dir" }
> };
>
> (Side note: remember that 644 and 755 are permitted synonyms for
> 100644 and 100755!)
>
> I personally think that simple state machines tend to be easier to
> follow if the current state is represented by the instruction pointer
> rather than a variable, as in the current fast-import.c. But maybe
> that's a matter of taste?
>
> Anyway, my other complaints about this dispatch_table are that the
> function names leave me rubbing my head and I can't keep the list
> of states you're transitioning between straight in my head. I guess
> "Adelete" is an abbreviation for print_delete_node_action? Is a
> callback needed at all (rather than just a string) for such actions?
True -- there are many intermediate layers where all kinds of
variables are getting set. It'll probably be a good idea to remove all
these abstraction layers and map fast-import commands directly to
dumpstream strings. I'll do this in the next iteration.
-- Ram
prev parent reply other threads:[~2011-02-02 2:55 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-02-01 14:26 [PATCH v3 0/3] Towards a Git-to-SVN bridge Ramkumar Ramachandra
2011-02-01 14:26 ` [PATCH 1/3] vcs-svn: Introduce svnload, a dumpfile producer Ramkumar Ramachandra
2011-02-01 14:46 ` Erik Faye-Lund
2011-02-02 2:53 ` Ramkumar Ramachandra
2011-02-02 12:43 ` Erik Faye-Lund
2011-02-01 14:26 ` [PATCH 2/3] t9010-svn-fi: Add tests for svn-fi Ramkumar Ramachandra
2011-02-01 18:58 ` Jonathan Nieder
2011-02-02 2:49 ` Ramkumar Ramachandra
2011-02-02 3:18 ` Jonathan Nieder
2011-02-01 14:26 ` [PATCH 3/3] vcs-svn: Refactor dump_export code into dispatch table Ramkumar Ramachandra
2011-02-01 17:42 ` Jonathan Nieder
2011-02-01 21:29 ` Junio C Hamano
2011-02-02 2:56 ` Ramkumar Ramachandra [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110202025626.GC11339@kytes \
--to=artagnon@gmail.com \
--cc=david.barr@cordelta.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
--cc=srabbelier@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.