monotone-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-devel] Manifest Comments


From: Markus Schiltknecht
Subject: [Monotone-devel] Manifest Comments
Date: Sun, 03 Dec 2006 18:45:36 +0100
User-agent: Icedove 1.5.0.8 (X11/20061128)

Hi,

I've been thinking about how to store additional information for a revision which got imported from another VCS (i.e. as cvs_import does). As certs are not stored and transmitted efficiently enough, it has been proposed to store such information in attributes.

However, that has various drawbacks. IMO, the most annoying one is that such attributes are inherited by child revisions. So let's say I have a manifest from an imported revision, which might look something like that:

manifest_of 0acef6004d07589fa5d7ae502bc78d2d4f8990e7
format_version "1"

dir ""

   file "fileA"
content [56ac1c08fa5479fd57c4a5c65861c4ed3ed93ff8]
   attr "RCS-REVISION" "1.2.1.6"

Whenever I commit a new revision, maybe into another branch, that revision inherits the RCS-REVISION attribute for fileA. Which is obviously wrong if fileA has changed. Also, this information should be used to allow subsequent cvs_import commands to continue from the last revision they imported and just add new revisions since the last import.

Thus, one would have to remove these attributes. I've been looking around about how to implement "vanishing attributes", which would disappear on a subsequent commit. But should they appear in a 'mtn diff'? Then a checked out revision would show lots of changes just after the checkout. Maybe they could silently be ignored? Anyway, implementing these special attributes seems quite a lot of work, after studying some of the code in rosters.cc.

Another point is, that these comments don't necessarily apply to files, but often to revisions (say, a svn_import could just list the svn revision number there). Of course we could also add an attribute to the root directory, but that seems like a hack.

Thus I've thought about another way: adding a 'comment' field to the Manifest. (I've been thinking about adding it to the Revision, but the revision merely shows changes, and a change set, while the manifest seems to list contents). Such a comment would have to be provided *before* committing and could not be changed afterwards. It would not be inherited by subsequent commits and would not show up in diffs.

I've added a trivial patch which adds the field with bogus content. I'm not sure how to continue from there, as I'd have to fiddle with roster->nodes and mappings...

Thus I'm asking for comment and thoughts, first.

Regards

Markus

P.S.: a manifest could look like:

manifest_of 0acef6004d07589fa5d7ae502bc78d2d4f8990e7
format_version "1"
       comment "imported from CVS on 12/03/2006

fileA: 1.2.1.6
"

dir ""

   file "fileA"
content [56ac1c08fa5479fd57c4a5c65861c4ed3ed93ff8]
# 
# old_revision [6a2036cae0ca461c169ae66696a84951a9233783]
# 
# patch "basic_io.hh"
#  from [d8c0da1addf5ce3ebda40f4508db86375620343a]
#    to [684298aa542d429853e5eccb88769025c88ff720]
# 
# patch "roster.cc"
#  from [3e46ae0e6698e47779091ef0b39f66cd31b1f2e2]
#    to [1332c1654a31cb0a9c40c64b0e97f37e89d91aea]
# 
============================================================
--- basic_io.hh d8c0da1addf5ce3ebda40f4508db86375620343a
+++ basic_io.hh 684298aa542d429853e5eccb88769025c88ff720
@@ -40,6 +40,7 @@ namespace basic_io
           symbol const file("file");
           symbol const content("content");
           symbol const attr("attr");
+          symbol const comment("comment");
       
           // 'local' roster and marking symbols
           // FIXME: should these be listed as "general" symbols here as well?
============================================================
--- roster.cc   3e46ae0e6698e47779091ef0b39f66cd31b1f2e2
+++ roster.cc   1332c1654a31cb0a9c40c64b0e97f37e89d91aea
@@ -2366,6 +2366,7 @@ roster_t::print_to(basic_io::printer & p
   {
     basic_io::stanza st;
     st.push_str_pair(basic_io::syms::format_version, "1");
+    st.push_str_pair(basic_io::syms::comment, "some comment here....");
     pr.print_stanza(st);
   }
   for (dfs_iter i(root_dir); !i.finished(); ++i)
@@ -2495,6 +2496,15 @@ roster_t::parse_from(basic_io::parser & 
           pa.str(ident);
           n = dir_t(new dir_node(read_num(ident)));
         }
+      else if (pa.symp(basic_io::syms::comment))
+        {
+          // TODO
+          L(FL("a comment..."));
+          pa.sym();
+          pa.str(pth);
+          L(FL("   the comment is: %s") % pth);
+          continue;
+        }
       else
         break;
 

reply via email to

[Prev in Thread] Current Thread [Next in Thread]