[osmium-tool] 01/05: Imported Upstream version 1.6.1
Bas Couwenberg
sebastic at debian.org
Mon Apr 10 18:18:25 UTC 2017
This is an automated email from the git hooks/post-receive script.
sebastic pushed a commit to branch master
in repository osmium-tool.
commit 0b8f3bc14f69469993ad2aff8f80c4ab0aba155a
Author: Bas Couwenberg <sebastic at xs4all.nl>
Date: Mon Apr 10 19:55:59 2017 +0200
Imported Upstream version 1.6.1
---
CHANGELOG.md | 18 +++++++++++-
CMakeLists.txt | 4 +--
README.md | 2 +-
man/osmium-derive-changes.md | 5 ++++
man/osmium-diff.md | 5 +++-
man/osmium-show.md | 2 +-
src/cmd.cpp | 15 ++++++----
src/cmd.hpp | 6 ++--
src/command_apply_changes.cpp | 5 +++-
src/command_cat.cpp | 2 +-
src/command_diff.cpp | 2 +-
src/command_extract.cpp | 1 -
src/command_renumber.cpp | 2 +-
src/command_show.cpp | 34 +++++++++++++++++------
src/command_show.hpp | 3 ++
src/exception.hpp | 30 ++++++++++++++++++++
src/extract/error.hpp | 55 -------------------------------------
src/extract/geojson_file_parser.cpp | 2 +-
src/extract/poly_file_parser.cpp | 2 +-
test/extract/test_unit.cpp | 2 +-
20 files changed, 110 insertions(+), 87 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 6959f9b..fdb8ffc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,21 @@ This project adheres to [Semantic Versioning](http://semver.org/).
### Fixed
+## [1.6.1] - 2017-04-10
+
+### Changed
+
+- Clarify differences between `diff` and `derive-changes` commands in man
+ pages.
+- Needs current libosmium 2.12.1 now.
+
+### Fixed
+
+- Use empty header for apply-changes instead of the one from input file.
+- Call 'less' with -R when using ANSI colors with 'show' command.
+- Do not show progress options on show command.
+
+
## [1.6.0] - 2017-03-07
### Added
@@ -251,7 +266,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
- Minor updates to documentation and build system
-[unreleased]: https://github.com/osmcode/osmium-tool/compare/v1.6.0...HEAD
+[unreleased]: https://github.com/osmcode/osmium-tool/compare/v1.6.1...HEAD
+[1.6.1]: https://github.com/osmcode/osmium-tool/compare/v1.6.0...v1.6.1
[1.6.0]: https://github.com/osmcode/osmium-tool/compare/v1.5.1...v1.6.0
[1.5.1]: https://github.com/osmcode/osmium-tool/compare/v1.5.0...v1.5.1
[1.5.0]: https://github.com/osmcode/osmium-tool/compare/v1.4.1...v1.5.0
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e209dea..ff4187a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -26,7 +26,7 @@ project(osmium)
set(OSMIUM_VERSION_MAJOR 1)
set(OSMIUM_VERSION_MINOR 6)
-set(OSMIUM_VERSION_PATCH 0)
+set(OSMIUM_VERSION_PATCH 1)
set(OSMIUM_VERSION ${OSMIUM_VERSION_MAJOR}.${OSMIUM_VERSION_MINOR}.${OSMIUM_VERSION_PATCH})
@@ -44,7 +44,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
find_package(Boost 1.55.0 REQUIRED COMPONENTS program_options)
include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
-find_package(Osmium 2.12.0 REQUIRED COMPONENTS io)
+find_package(Osmium 2.12.1 REQUIRED COMPONENTS io)
include_directories(SYSTEM ${OSMIUM_INCLUDE_DIRS})
diff --git a/README.md b/README.md
index 0bac60b..166357b 100644
--- a/README.md
+++ b/README.md
@@ -16,7 +16,7 @@ later are known to work. It also works on modern Visual Studio C++ compilers.
You also need the following libraries:
- Libosmium (>= 2.11.0)
+ Libosmium (>= 2.12.1)
http://osmcode.org/libosmium
Debian/Ubuntu: libosmium2-dev
diff --git a/man/osmium-derive-changes.md b/man/osmium-derive-changes.md
index 192d803..639e984 100644
--- a/man/osmium-derive-changes.md
+++ b/man/osmium-derive-changes.md
@@ -18,6 +18,11 @@ applied on *OSM-FILE1* to re-create *OSM-FILE2*.
Objects in both input files must be sorted by type, ID, and version. The first
input file must be from a point in time before the second input file.
+Only object type, id, and version are compared, so this program will not detect
+differences in, say, the tags, unless the object has a new version, which is
+the normal way things work in OSM. If you need to compare all data in OSM
+files, have a look at the **osmium diff** program.
+
For this command to create a proper change file you have to set the
**--output** option or **--output-format** option in a way that it will
generate an .osc file, typically by using something like '-o out.osc.gz'.
diff --git a/man/osmium-diff.md b/man/osmium-diff.md
index 5831476..301fdd7 100644
--- a/man/osmium-diff.md
+++ b/man/osmium-diff.md
@@ -11,7 +11,10 @@ osmium-diff - display differences between OSM files
# DESCRIPTION
-Finds differences between two OSM files and displays them.
+Finds all differences between two OSM files and displays them. This command
+compares all attributes of all objects, so it will even find, say, differences
+in the user name or even the order of tags, differences that should not happen
+in normal OSM data unless there is also a different object version.
Only differences between objects (node, ways, and relations) are found and
displayed. Headers are ignored.
diff --git a/man/osmium-show.md b/man/osmium-show.md
index c1c37dd..e78193e 100644
--- a/man/osmium-show.md
+++ b/man/osmium-show.md
@@ -81,7 +81,7 @@ Show an OSM file using the default pager and default format:
Use `more` as a pager and only show relations:
- OSMIUM_PAGER=more osmium show -r norway.osm.pbf
+ OSMIUM_PAGER=more osmium show -t r norway.osm.pbf
Show using XML format:
diff --git a/src/cmd.cpp b/src/cmd.cpp
index b51def0..83369b9 100644
--- a/src/cmd.cpp
+++ b/src/cmd.cpp
@@ -30,16 +30,19 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "cmd.hpp"
#include "exception.hpp"
-po::options_description Command::add_common_options() {
+po::options_description Command::add_common_options(bool with_progress) {
po::options_description options("COMMON OPTIONS");
- options.add_options()
+ auto opts = options.add_options()
("help,h", "Show usage help")
- ("progress", "Display progress bar")
- ("no-progress", "Suppress display of progress bar")
("verbose,v", "Set verbose mode")
;
+ if (with_progress) {
+ opts("progress", "Display progress bar")
+ ("no-progress", "Suppress display of progress bar");
+ }
+
return options;
}
@@ -71,7 +74,7 @@ void Command::setup_progress(const boost::program_options::variables_map& vm) {
}
}
-void Command::setup_object_type_nrwc(const boost::program_options::variables_map& vm) {
+void Command::setup_object_type_nwrc(const boost::program_options::variables_map& vm) {
if (vm.count("object-type")) {
m_osm_entity_bits = osmium::osm_entity_bits::nothing;
for (const auto& t : vm["object-type"].as<std::vector<std::string>>()) {
@@ -92,7 +95,7 @@ void Command::setup_object_type_nrwc(const boost::program_options::variables_map
}
}
-void Command::setup_object_type_nrw(const boost::program_options::variables_map& vm) {
+void Command::setup_object_type_nwr(const boost::program_options::variables_map& vm) {
if (vm.count("object-type")) {
m_osm_entity_bits = osmium::osm_entity_bits::nothing;
for (const auto& t : vm["object-type"].as<std::vector<std::string>>()) {
diff --git a/src/cmd.hpp b/src/cmd.hpp
index 2da27a3..05bff63 100644
--- a/src/cmd.hpp
+++ b/src/cmd.hpp
@@ -101,11 +101,11 @@ public:
// The command line usage synopsis of the command.
virtual const char* synopsis() const noexcept = 0;
- po::options_description add_common_options();
+ po::options_description add_common_options(bool with_progress = true);
void setup_common(const boost::program_options::variables_map& vm, const po::options_description& desc);
void setup_progress(const boost::program_options::variables_map& vm);
- void setup_object_type_nrwc(const boost::program_options::variables_map& vm);
- void setup_object_type_nrw(const boost::program_options::variables_map& vm);
+ void setup_object_type_nwrc(const boost::program_options::variables_map& vm);
+ void setup_object_type_nwr(const boost::program_options::variables_map& vm);
void show_object_types(osmium::util::VerboseOutput& vout);
void print_arguments(const std::string& command);
void show_memory_used();
diff --git a/src/command_apply_changes.cpp b/src/command_apply_changes.cpp
index 46be0b2..985b3df 100644
--- a/src/command_apply_changes.cpp
+++ b/src/command_apply_changes.cpp
@@ -213,8 +213,11 @@ bool CommandApplyChanges::run() {
m_vout << "Opening input file...\n";
osmium::io::Reader reader{m_input_file, osmium::osm_entity_bits::object};
- osmium::io::Header header{reader.header()};
+ osmium::io::Header header;
setup_header(header);
+ if (m_with_history) {
+ header.set_has_multiple_object_versions(true);
+ }
if (m_locations_on_ways) {
m_output_file.set("locations_on_ways");
diff --git a/src/command_cat.cpp b/src/command_cat.cpp
index c6763e0..5eff3d9 100644
--- a/src/command_cat.cpp
+++ b/src/command_cat.cpp
@@ -67,7 +67,7 @@ bool CommandCat::setup(const std::vector<std::string>& arguments) {
setup_common(vm, desc);
setup_progress(vm);
- setup_object_type_nrwc(vm);
+ setup_object_type_nwrc(vm);
setup_input_files(vm);
setup_output_file(vm);
diff --git a/src/command_diff.cpp b/src/command_diff.cpp
index ea488cb..377c990 100644
--- a/src/command_diff.cpp
+++ b/src/command_diff.cpp
@@ -81,7 +81,7 @@ bool CommandDiff::setup(const std::vector<std::string>& arguments) {
po::notify(vm);
setup_common(vm, desc);
- setup_object_type_nrw(vm);
+ setup_object_type_nwr(vm);
setup_input_files(vm);
if (m_input_files.size() != 2) {
diff --git a/src/command_extract.cpp b/src/command_extract.cpp
index 1545613..3874252 100644
--- a/src/command_extract.cpp
+++ b/src/command_extract.cpp
@@ -48,7 +48,6 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "command_extract.hpp"
#include "exception.hpp"
-#include "extract/error.hpp"
#include "extract/extract_bbox.hpp"
#include "extract/extract_polygon.hpp"
#include "extract/geojson_file_parser.hpp"
diff --git a/src/command_renumber.cpp b/src/command_renumber.cpp
index aa5a527..e6aad47 100644
--- a/src/command_renumber.cpp
+++ b/src/command_renumber.cpp
@@ -139,7 +139,7 @@ bool CommandRenumber::setup(const std::vector<std::string>& arguments) {
setup_common(vm, desc);
setup_progress(vm);
- setup_object_type_nrw(vm);
+ setup_object_type_nwr(vm);
setup_input_file(vm);
setup_output_file(vm);
diff --git a/src/command_show.cpp b/src/command_show.cpp
index c35e795..49179d1 100644
--- a/src/command_show.cpp
+++ b/src/command_show.cpp
@@ -40,6 +40,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include "command_show.hpp"
#include "exception.hpp"
+#include "util.hpp"
#ifndef _MSC_VER
void CommandShow::setup_pager_from_env() noexcept {
@@ -73,7 +74,7 @@ bool CommandShow::setup(const std::vector<std::string>& arguments) {
("output-format,f", po::value<std::string>(), "Format of output file")
;
- po::options_description opts_common{add_common_options()};
+ po::options_description opts_common{add_common_options(false)};
po::options_description opts_input{add_single_input_options()};
po::options_description hidden;
@@ -95,7 +96,7 @@ bool CommandShow::setup(const std::vector<std::string>& arguments) {
po::notify(vm);
setup_common(vm, desc);
- setup_object_type_nrwc(vm);
+ setup_object_type_nwrc(vm);
setup_input_file(vm);
#ifndef _MSC_VER
@@ -128,17 +129,28 @@ bool CommandShow::setup(const std::vector<std::string>& arguments) {
}
}
+ m_color_output = m_output_format.find("color=true") != std::string::npos;
+
return true;
}
+void CommandShow::show_arguments() {
+ show_single_input_arguments(m_vout);
+ m_vout << " other options:\n";
+ m_vout << " file format: " << m_output_format << "\n";
+ m_vout << " use color: " << yes_no(m_color_output);
+ m_vout << " use pager: " << (m_pager == "" ? "(no pager)" : m_pager) << "\n";
+ show_object_types(m_vout);
+}
+
#ifndef _MSC_VER
-static int execute_pager(const std::string& pager) {
+static int execute_pager(const std::string& pager, bool with_color) {
int pipefd[2];
if (::pipe(pipefd) < 0) {
throw std::system_error{errno, std::system_category(), "Could not run pager: pipe() call failed"};
}
- pid_t pid = fork();
+ const pid_t pid = fork();
if (pid < 0) {
throw std::system_error{errno, std::system_category(), "Could not run pager: fork() call failed"};
}
@@ -151,8 +163,12 @@ static int execute_pager(const std::string& pager) {
std::exit(1);
}
- // execute pager without arguments
- ::execlp(pager.c_str(), pager.c_str(), nullptr);
+ if (with_color && pager.substr(pager.size() - 4, 4) == "less") {
+ ::execlp(pager.c_str(), pager.c_str(), "-R", nullptr);
+ } else {
+ // execute pager without arguments
+ ::execlp(pager.c_str(), pager.c_str(), nullptr);
+ }
// Exec will either succeed and never return here, or it fails and
// we'll exit.
@@ -175,15 +191,15 @@ bool CommandShow::run() {
osmium::io::Header header{reader.header()};
if (m_pager.empty()) {
- osmium::io::File file("-", m_output_format);
- osmium::io::Writer writer(file, header);
+ osmium::io::File file{"-", m_output_format};
+ osmium::io::Writer writer{file, header};
while (osmium::memory::Buffer buffer = reader.read()) {
writer(std::move(buffer));
}
writer.close();
} else {
#ifndef _MSC_VER
- int fd = execute_pager(m_pager);
+ const int fd = execute_pager(m_pager, m_color_output);
::close(1); // close stdout
if (::dup2(fd, 1) < 0) { // put end of pipe as stdout
diff --git a/src/command_show.hpp b/src/command_show.hpp
index 7061b71..d3624db 100644
--- a/src/command_show.hpp
+++ b/src/command_show.hpp
@@ -34,6 +34,7 @@ class CommandShow : public Command, public with_single_osm_input {
std::string m_output_format{"debug,color=true"};
std::string m_pager;
+ bool m_color_output;
void setup_pager_from_env() noexcept;
@@ -43,6 +44,8 @@ public:
bool setup(const std::vector<std::string>& arguments) override final;
+ void show_arguments() override final;
+
bool run() override final;
const char* name() const noexcept override final {
diff --git a/src/exception.hpp b/src/exception.hpp
index 93131af..dab5f18 100644
--- a/src/exception.hpp
+++ b/src/exception.hpp
@@ -24,6 +24,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <stdexcept>
+#include <string>
/**
* Thrown when there is a problem with the command line arguments.
@@ -40,5 +41,34 @@ struct argument_error : std::runtime_error {
};
+/**
+ * Thrown when there is a problem with parsing a JSON config file.
+ */
+struct config_error : public std::runtime_error {
+
+ explicit config_error(const char* message) :
+ std::runtime_error(message) {
+ }
+
+ explicit config_error(const std::string& message) :
+ std::runtime_error(message) {
+ }
+
+}; // struct config_error
+
+/**
+ * Thrown when there is a problem with parsing a GeoJSON file.
+ */
+struct geojson_error : public std::runtime_error {
+
+ explicit geojson_error(const char* message) :
+ std::runtime_error(message) {
+ }
+
+ explicit geojson_error(const std::string& message) :
+ std::runtime_error(message) {
+ }
+
+}; // struct geojson_error
#endif // EXCEPTION_HPP
diff --git a/src/extract/error.hpp b/src/extract/error.hpp
deleted file mode 100644
index 6a3a0c0..0000000
--- a/src/extract/error.hpp
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef EXTRACT_ERROR_HPP
-#define EXTRACT_ERROR_HPP
-
-/*
-
-Osmium -- OpenStreetMap data manipulation command line tool
-http://osmcode.org/osmium-tool/
-
-Copyright (C) 2013-2017 Jochen Topf <jochen at topf.org>
-
-This program is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program. If not, see <https://www.gnu.org/licenses/>.
-
-*/
-
-#include <stdexcept>
-#include <string>
-
-/**
- * Thrown when there is a problem with parsing the JSON config file.
- */
-struct config_error : public std::runtime_error {
-
- explicit config_error(const char* message) :
- std::runtime_error(message) {
- }
-
- explicit config_error(const std::string& message) :
- std::runtime_error(message) {
- }
-
-}; // struct config_error
-
-/**
- * Thrown when there is a problem with parsing a GeoJSON file.
- */
-struct geojson_error : public std::runtime_error {
-
- explicit geojson_error(const std::string& message) :
- std::runtime_error(message) {
- }
-
-}; // struct geojson_error
-
-#endif // EXTRACT_ERROR_HPP
diff --git a/src/extract/geojson_file_parser.cpp b/src/extract/geojson_file_parser.cpp
index e844979..874185b 100644
--- a/src/extract/geojson_file_parser.cpp
+++ b/src/extract/geojson_file_parser.cpp
@@ -34,7 +34,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <osmium/memory/buffer.hpp>
#include <osmium/osm/location.hpp>
-#include "error.hpp"
+#include "../exception.hpp"
#include "geojson_file_parser.hpp"
std::string get_value_as_string(const rapidjson::Value& object, const char* key) {
diff --git a/src/extract/poly_file_parser.cpp b/src/extract/poly_file_parser.cpp
index 0a03a01..a23d499 100644
--- a/src/extract/poly_file_parser.cpp
+++ b/src/extract/poly_file_parser.cpp
@@ -29,7 +29,7 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
#include <osmium/memory/buffer.hpp>
#include <osmium/util/string.hpp>
-#include "error.hpp"
+#include "../exception.hpp"
#include "poly_file_parser.hpp"
void PolyFileParser::error(const std::string& message) {
diff --git a/test/extract/test_unit.cpp b/test/extract/test_unit.cpp
index 6957164..aeba22b 100644
--- a/test/extract/test_unit.cpp
+++ b/test/extract/test_unit.cpp
@@ -3,7 +3,7 @@
#include <osmium/memory/buffer.hpp>
-#include "error.hpp"
+#include "exception.hpp"
#include "poly_file_parser.hpp"
#include "osm_file_parser.hpp"
#include "geojson_file_parser.hpp"
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-grass/osmium-tool.git
More information about the Pkg-grass-devel
mailing list