如果我有这样的分支主控和主题:
A -- B -- C -- D (master)
\
W -- X -- Y -- Z (topic)
Run Code Online (Sandbox Code Playgroud)
我需要通过各种修复、压缩、修正等来操作“主题”上的提交,我通常会签出“主题”并运行git rebase -i. 假设我这样做了,并将 Z 压缩为 Y,所以它作为一个独特的提交消失了。默认情况下会git rebase -i重新定位到 master 的头部,所以我会得到:
A -- B -- C -- D (master)
\
W -- X -- YZ
Run Code Online (Sandbox Code Playgroud)
现在,通常我实际上不希望 master 上的新提交在我的主题分支上可见(例如可能会导致昂贵的重新编译)。
推荐的方法是git rebase -i HEAD~4在“主题”时发布。太棒了,这让我得到了我真正想要的东西,Y 和 Z 被压扁了,主题仍然起源于“B”。
A -- B -- C -- D (master)
\
W -- X -- YZ (topic)
Run Code Online (Sandbox Code Playgroud)
但是,我不喜欢的是我需要手动计算主题中的提交数量。这可能很大,并且肯定会改变,所以我不能只是从我的 shell 历史记录中重新运行它。每次我想要执行此操作时,我都需要运行“git log”、计算提交次数、编辑命令等,并且我始终“rebase -i”。 …
我有一个外部命令行程序,我想从elisp调用.这是壳命令很容易,但是当命令行程序是互动的,这在我的特殊情况下,它不能正常工作:被调用的脚本看到EOF时,它读取标准输入,当我这样称呼它:
;; upload command is a string with the name of
;; a python script and some args
(shell-command upload-command
(get-buffer-create "*upload output*")))))
Run Code Online (Sandbox Code Playgroud)
upload-command标识的python脚本可能会询问一些是/否问题,并且可能会提示输入密码,我想要屏蔽输入.理想情况下,所有这些交互都会发生在迷你缓冲区内.
我如何安排事情,以便当通过elisp调用时,我的外部交互式命令通过迷你缓冲区与用户交互?
我目前正在尝试将JSON文件插入到我的mongoDB中。我已经看到过去已经通过使用mongo :: BSONObj解决了这个问题……但这似乎不是一个选择,因为他们发布了适用于c ++ 11的新mongocxx驱动程序。这是我在bsoncxx src文件中找到的:
BSONCXX_API document::value BSONCXX_CALL from_json(stdx::string_view json);
/// Constructs a new document::value from the provided JSON text
///
/// @param 'json'
/// A string_view into a JSON document
///
/// @returns A document::value if conversion worked.
///
/// @throws bsoncxx::exception with error details if the conversion failed.
///
Run Code Online (Sandbox Code Playgroud)
如何将JSON文件放入stdx::string_view?
谢谢!
我的程序可能连接很少,我需要关闭每个连接.请帮帮我.
#include <iostream>
#include <bsoncxx/builder/stream/document.hpp>
#include <bsoncxx/json.hpp>
#include <mongocxx/client.hpp>
#include <mongocxx/instance.hpp>
int main(int, char**) {
mongocxx::instance inst{};
mongocxx::client conn{mongocxx::uri{}};
bsoncxx::builder::stream::document document{};
auto collection = conn["testdb"]["testcollection"];
document << "hello" << "world";
collection.insert_one(document.view());
auto cursor = collection.find({});
for (auto&& doc : cursor) {
std::cout << bsoncxx::to_json(doc) << std::endl;
}
need close connection
}
Run Code Online (Sandbox Code Playgroud)
conn.close()或我该如何关闭它?