monotone-devel
[Top][All Lists]
Advanced

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

[Monotone-devel] automate get_current_revision [was --non-interactive ..


From: Zbigniew Zagórski
Subject: [Monotone-devel] automate get_current_revision [was --non-interactive ... ]
Date: Thu, 31 Jan 2008 14:53:45 +0100
User-agent: Thunderbird 2.0.0.9 (Windows/20071031)

Thomas Keller wrote:
...
>
> On a related note, if you think of doing commits over automate like > I currently do, what is really _lacking_ in automate is a way to let > mtn
> return a valid restricted revision for a given set of paths (i.e. I
> currently just feed put_revision with the complete output of
> get_revision). One could of course do the node restriction logic in > the client (f.e. for renames), but this is very ugly.

How about adding:

        automate get_current_revision [PATHS...]

Which will return current workspace revision restricted with PATHS.
Now when automate commands can accept options it will be possible to add --depth and --exclude options also.

Anybody from core can confirm that it's a correct way to create revision ? (it works) (never mind fact it's a hack in get_revision).

============================================================
--- automate.cc 36060912ba341b40831791a08530893de5715809
+++ automate.cc dfa663aa8f827f41fa4a35804d54cf055872714f
@@ -1159,25 +1159,37 @@ CMD_AUTOMATE(get_revision, N_("[REVID]")
              "",
              options::opts::none)
 {
-  N(args.size() < 2,
-    F("wrong argument count"));
+  //N(args.size() < 2,
+  //  F("wrong argument count"));

   temp_node_id_source nis;
   revision_data dat;
   revision_id ident;

-  if (args.size() == 0)
+  if (args.size() == 0 || idx(args,0)().size() == 0)
     {
+
       roster_t new_roster;
       parent_map old_rosters;
       revision_t rev;
-
+      cset excluded;
       app.require_workspace();
       app.work.get_parent_rosters(old_rosters);
       app.work.get_current_roster_shape(new_roster, nis);
-      app.work.update_current_roster_from_filesystem(new_roster);
+
+      args_vector args2;
+      args2.insert(args2.begin(), args.begin()+1, args.end());
+
+      node_restriction mask(args_to_paths(args2),
+                        std::vector<file_path>(),
+                        -1,
+                        old_rosters, new_roster, app);
+
+      app.work.update_current_roster_from_filesystem(new_roster,
+                                                     mask);

       make_revision(old_rosters, new_roster, rev);
+      make_restricted_revision(old_rosters, new_roster, mask, rev,
+                           excluded, execid);
       calculate_ident(rev, ident);
       write_revision(rev, dat);
     }

I've just updated revision creation code from CMD(commit).

--
Zbigniew Zagórski
/ software developer / geek / happy daddy /






reply via email to

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