monotone-commits-diffs
[Top][All Lists]
Advanced

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

[Monotone-commits-diffs] net.venge.monotone: fb074f470e8850b00f87bb10369


From: code
Subject: [Monotone-commits-diffs] net.venge.monotone: fb074f470e8850b00f87bb10369ff7f98015e4fe
Date: Sat, 5 May 2012 00:13:50 +0200 (CEST)

revision:            fb074f470e8850b00f87bb10369ff7f98015e4fe
date:                2012-05-04T22:16:16
author:              Richard Hopkins <address@hidden>
branch:              net.venge.monotone
changelog:
Implement 'erase_descendants' automate command with func tests, NEWS entry and 
documentation

I've mentioned it's added in interface version 13.1 but haven't bumped it yet.
That will come in a separate commit where we mention it in NEWS as well.

manifest:
format_version "1"

new_manifest [f38edcaf481c5963cb2e4b895b524e567061829e]

old_revision [ab1768da0fde81a823a77f7b92cb6bf6f1662b45]

add_dir "test/func/automate_erase_descendants"

patch "NEWS"
 from [e2f75fe4e775336683ea15030378d9c771ead705]
   to [17c819736b0893e4d4667526656138ed23cb4b48]

patch "doc/monotone.texi"
 from [84062ca3af04d8d5ed1ba3624eda8c9d808cf61c]
   to [7b7f4e950e7fc284363246761f612d85d65b9744]

patch "src/automate.cc"
 from [efa4ecceab7f1e31f71778f325da312bf6aefba5]
   to [919e3df52514d0877aeafc67791aae6a3faa33b4]
============================================================
--- NEWS	e2f75fe4e775336683ea15030378d9c771ead705
+++ NEWS	17c819736b0893e4d4667526656138ed23cb4b48
@@ -10,6 +10,10 @@ XXX XXX XX XX:XX:XX UTC 201X
           and returns the attributes for a specific file from the
           revision's manifest
 
+        - New 'erase_descendants' automate command which returns all
+          input revisions, except those that are a descendant of
+          another revision in the input.
+
         - New 'min(A)' selector is now available which returns all
           revisions selected by A which are not descendants of other
           revisions selected by A.
============================================================
--- doc/monotone.texi	84062ca3af04d8d5ed1ba3624eda8c9d808cf61c
+++ doc/monotone.texi	7b7f4e950e7fc284363246761f612d85d65b9744
@@ -7523,7 +7523,48 @@ @section Automation
 
 @end table
 
address@hidden mtn automate erase_descendants address@hidden
 
address@hidden @strong
address@hidden Arguments:
+
+One or more revision IDs.
+
address@hidden Added in:
+
+13.1
+
address@hidden Purpose:
+
+Prints all arguments, except those that are a descendant of some other
+argument.
+
+One way to think about this is that it prints the minimal elements of
+the given set, under the ordering imposed by the ``parent of''
+relation.  Another way to think of it is if the arguments formed a
+branch, then we would print the roots of that branch.  If there are no
+arguments, prints nothing.
+
address@hidden Sample output:
+
address@hidden
+28ce076c69eadb9b1ca7bdf9d40ce95fe2f29b61
+75156724e0e2e3245838f356ec373c50fa469f1f
address@hidden verbatim
+
address@hidden Output format:
+
+Zero or more lines, each giving the ID of one of the given revisions.
+Each line consists of a revision ID, in hexadecimal, followed by a
+newline.  The lines are printed in alphabetically sorted order.
+
address@hidden Error conditions:
+
+If any of the revisions do not exist, prints nothing to stdout, prints
+an error message to stderr, and exits with status 1.
+
address@hidden table
+
 @item mtn automate file_merge @var{left-rid} @var{left-path} @var{right-rid} @var{right-path}
 
 @table @strong
============================================================
--- src/automate.cc	efa4ecceab7f1e31f71778f325da312bf6aefba5
+++ src/automate.cc	919e3df52514d0877aeafc67791aae6a3faa33b4
@@ -240,6 +240,39 @@ CMD_AUTOMATE(erase_ancestors, N_("[REV1 
     output << *i << '\n';
 }
 
+// Name: erase_descendants
+// Arguments:
+//   0 or more: revision ids
+// Added in: 13.1
+// Purpose: Prints all arguments, except those that are a descendant of some
+//   other argument.  One way to think about this is that it prints the
+//   minimal elements of the given set, under the ordering imposed by the
+//   "parent of" relation.  Another way to think of it is if the arguments were
+//   a branch, then we print the roots of that branch.
+// Output format: A list of revision ids, in hexadecimal, each followed by a
+//   newline.  Revision ids are printed in alphabetically sorted order.
+// Error conditions: If any of the revisions do not exist, prints nothing to
+//   stdout, prints an error message to stderr, and exits with status 1.
+CMD_AUTOMATE(erase_descendants, N_("[REV1 [REV2 [REV3 [...]]]]"),
+             N_("Erases the descendants in a list of revisions"),
+             "",
+             options::opts::none)
+{
+  database db(app);
+
+  set<revision_id> revs;
+  for (args_vector::const_iterator i = args.begin(); i != args.end(); ++i)
+    {
+      revision_id rid(decode_hexenc_as<revision_id>((*i)(), origin::user));
+      E(db.revision_exists(rid), origin::user,
+        F("no revision %s found in database") % rid);
+      revs.insert(rid);
+    }
+  erase_descendants(db, revs);
+  for (set<revision_id>::const_iterator i = revs.begin(); i != revs.end(); ++i)
+    output << *i << '\n';
+}
+
 // Name: toposort
 // Arguments:
 //   0 or more: revision ids

reply via email to

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