Petr Onderka has submitted this change and it was merged.

Change subject: The create action reads from stdin when file is -
......................................................................


The create action reads from stdin when file is -

Change-Id: I3df1dac202323d7cf8b7bf04dcdb6bc7eb85b94e
---
M README.md
M main.cpp
2 files changed, 10 insertions(+), 2 deletions(-)

Approvals:
  Petr Onderka: Verified; Looks good to me, approved



diff --git a/README.md b/README.md
index 0cf68c3..88cb0c4 100644
--- a/README.md
+++ b/README.md
@@ -104,7 +104,7 @@
 
 * Name of the wiki.
 * Timestamp of the created dump.
-* Path to the source XML dump.
+* Path to the source XML dump. If the path is `-`, the source XML is read from 
the standard input. This can be useful for reading a compressed XML file 
without an intermediary file.
 
 The remaining parameters specify what dumps to creates, just as in `update`.
 
diff --git a/main.cpp b/main.cpp
index 28f3080..ab3962b 100644
--- a/main.cpp
+++ b/main.cpp
@@ -161,7 +161,15 @@
 
     writer.SetDumpKind(DumpKind::None);
 
-    XmlMediawikiProcessor::Process(&writer, inputFileName);
+    if (inputFileName == "-")
+    {
+        auto stream = WrapperInputStream(std::cin);
+        XmlMediawikiProcessor::Process(&writer, stream);
+    }
+    else
+    {
+        XmlMediawikiProcessor::Process(&writer, inputFileName);
+    }
 
     writer.Complete();
 }

-- 
To view, visit https://gerrit.wikimedia.org/r/84127
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I3df1dac202323d7cf8b7bf04dcdb6bc7eb85b94e
Gerrit-PatchSet: 2
Gerrit-Project: operations/dumps/incremental
Gerrit-Branch: gsoc
Gerrit-Owner: Petr Onderka <[email protected]>
Gerrit-Reviewer: Petr Onderka <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to