#
# patch "ChangeLog"
# from [b3e0e2a03c355cce0615f8bd98f260b7176706a9]
# to [139340afb6db042cbdbef33d1e751bc6d83bc92a]
#
# patch "cert.cc"
# from [7375c4ce0944680b0b1347414d653139f6c828c7]
# to [fad17e07415bdeb0dc09d24ad33be14fdb642888]
#
# patch "cert.hh"
# from [e2b1d86c8f2610e854afed7ab661c4c2554e7004]
# to [45eb58bccf8d116b8937a45c950793d92fab8207]
#
# patch "git.cc"
# from [203033d75ca89c0025f03b41b84c620b0098f335]
# to [afda5c67df836c0fcab2822296261aa2d2d54e55]
#
========================================================================
--- ChangeLog b3e0e2a03c355cce0615f8bd98f260b7176706a9
+++ ChangeLog 139340afb6db042cbdbef33d1e751bc6d83bc92a
@@ -1,4 +1,12 @@
+2005-08-20 Petr Baudis
+ * cert.hh, cert.cc: Publish put_simple_revision_cert() - that
+ hints that it is ok to do custom certificates and lets us easily
+ do so from the GIT importer.
+ * git.cc: Associate a gitcommit cert containing commit and author
+ information with each imported commit. This will be especially
+ important for incremental imports.
+
2005-08-18 Petr Baudis
* Makefile.am, git.hh, git.cc: Initial support for importing from
GIT repositories to Monotone. This is pretty basic yet, full of
========================================================================
--- cert.cc 7375c4ce0944680b0b1347414d653139f6c828c7
+++ cert.cc fad17e07415bdeb0dc09d24ad33be14fdb642888
@@ -512,7 +512,7 @@
c = t;
}
-static void
+void
put_simple_revision_cert(revision_id const & id,
cert_name const & nm,
cert_value const & val,
========================================================================
--- cert.hh e2b1d86c8f2610e854afed7ab661c4c2554e7004
+++ cert.hh 45eb58bccf8d116b8937a45c950793d92fab8207
@@ -64,6 +64,11 @@
cert_value const & cv,
app_state & app,
cert & c);
+void put_simple_revision_cert(revision_id const & id,
+ cert_name const & nm,
+ cert_value const & val,
+ app_state & app,
+ packet_consumer & pc);
void erase_bogus_certs(std::vector< revision > & certs,
app_state & app);
========================================================================
--- git.cc 203033d75ca89c0025f03b41b84c620b0098f335
+++ git.cc afda5c67df836c0fcab2822296261aa2d2d54e55
@@ -335,6 +335,19 @@
}
}
+static void
+parse_person_line(string &line, git_person &person, time_t &time)
+{
+ int emailstart = line.find('<');
+ int emailend = line.find('>', emailstart);
+ int timeend = line.find(' ', emailend + 2);
+ person.name = line.substr(0, emailstart - 1);
+ person.email = line.substr(emailstart + 1, emailend - emailstart - 1);
+ time = atol(line.substr(emailend + 2, timeend - emailend - 2).c_str());
+ L(F("Person name: '%s', email: '%s', time: '%d'")
+ % person.name % person.email % time);
+}
+
static revision_id
import_git_commit(git_history &git, app_state &app, git_object_id gitrid)
{
@@ -348,8 +361,8 @@
manifest_map manifest;
// XXX: it might be user policy decision whether to take author or committer
// as monotone author; the time should be always commit time, though
- //git_person author();
- //time_t author_time = 0;
+ git_person author;
+ time_t author_time = 0;
git_person committer;
time_t commit_time = 0;
string logmsg;
@@ -415,15 +428,12 @@
}
else if (keyword == "committer")
{
- int emailstart = param.find('<');
- int emailend = param.find('>', emailstart);
- int timeend = param.find(' ', emailend + 2);
- committer.name = param.substr(0, emailstart - 2);
- committer.email = param.substr(emailstart + 1, emailend - emailstart - 1);
- commit_time = atol(param.substr(emailend + 2, timeend - emailend - 2).c_str());
- L(F("Committer name: '%s', email: '%s', time: '%d'")
- % committer.name % committer.email % commit_time);
+ parse_person_line(param, committer, commit_time);
}
+ else if (keyword == "author")
+ {
+ parse_person_line(param, author, author_time);
+ }
}
delete &fb;
@@ -443,6 +453,15 @@
cert_revision_changelog(rid, logmsg, app, dbw);
cert_revision_date_time(rid, commit_time, app, dbw);
+ static string const gitcommit_id_cert_name = "gitcommit-id";
+ static string const gitcommit_author_cert_name = "gitcommit-author";
+ put_simple_revision_cert(rid, gitcommit_id_cert_name,
+ gitrid(), app, dbw);
+ string authorcert = author.name + " <" + author.email + "> "
+ + boost::lexical_cast(author_time);
+ put_simple_revision_cert(rid, gitcommit_author_cert_name,
+ authorcert, app, dbw);
+
return rid;
}