How to use merge tool "internal:fail" programmatically? - python-2.7

I am new in the Mercurial, and I am interested in the merging process. I would like to see how it happens programmatically, but something did not work out. I do not understand how to call the option, as we do it from the console using the hg merge --tool internal:fail command.
I did it like this
commands.merge(ui, repo, tool='internal:fail'),
but it still runs the default kdiff3.
I tried to do this
ui.setconfig('ui', 'merge', 'internal:fail')
commands.merge(ui, repo),
but it works like the previous one.
If someone understands what I'm doing wrong and how to fix it, please answer me.
Thank you for your attention to my question, have a good time =)

I managed to find the answer to my question, if someone needs it, look
We need to override the repository as follows:
def reposetup (ui, repo):
repo.ui.setconfig ('ui', 'merge', 'internal: fail') # or smth else, for example "merge3"
repo.ui.setconfig ('ui', 'interactive', 'no')
After this, the merge command will follow the configuration we defined =)

Related

How to list tables in RethinkDb using C++

When I do something in Python or in JavaScript I always have a lot of opportunities, both, to read documentation of a particular library and to try tons of teeny-weeny examples.
Unfortunatelly, in C++ it is not so popular (for what reason?) to provide at least a little ammount of working examples in documentation. Two good examples are C++ clients for MongoDb and RethinkDb.
My question here concerns RethinkDB. In Python I know how to list all table names, not because there is documentation and I'm supposed to dive into the driver code, but just because there is a tiny handy example of doing this:
r.db('test').table_list().run(conn)
And I'm done. In C++ I do not know how to do this - how to list all table names. I do not know even if there is such a method. I wish someone could provide little instructions and share their knowledge.
EDIT
It seems, like I found an appropriate method table_list, but unfortunatelly I do not know how to use it. Besides, it seems that I try to connect to the database in a wrong manner - by this I mean that I connect to the server, but not to a particular database (and again I do not know how to implement this). So, this is what I have now:
std::unique_ptr<R::Connection> conn = R::connect("localhost",28105);
//^^^ I want to connect to a particular database "mydb" - how to do that?
R::Cursor cursor = R::table_list().run(*conn);
for(R::Datum& item : cursor){
do_something(R::write_datum(item).c_str());
// ^^^ is that right???
}
If I do it, like I showed - without specifying the database name, then I get nothing. If, however, I try to connect like this:
R::connect("localhost",28105,"mydb");
then inside for I get an infinite loop. So, I need some help. Thanks!
EDIT
Phew, I found a solution. And I must confess, that it is rather intuitive. I will post it below.
This is the solution:
std::unique_ptr<R::Connection> conn = R::connect("localhost",28105);
R::Cursor cursor = R::db("mydb").table_list().run(*conn);
for(R::Datum& item : cursor){
do_something(R::write_datum(item).c_str());
}
and it works great. I want to thank AtnNn - the sole developper of this great driver.

Embedding Rekall in an external python program

http://docs.rekall.googlecode.com/git/tutorial.html#_embedding_rekall_in_an_external_python_program
I try to run the program as the link suggested, however i am getting this error
"ValueError: Unable to load profile WinXPSP2x86 from any repository."
look like it does not automatically search for Profile like running commands
this should be the old codes, as WinXPSP3 is not a valid profile name, so with the suggestion from the author, I am looking into
https://code.google.com/p/grr/source/browse/client/client_actions/grr_rekall.py#157
but i am new to it, need some help to make it work
e.g. import an image, and call pslist
any ideas? thanks a lot!
You are just following an old link that is not accessible anyway.
http://www.rekall-forensic.com/docs/Manual/tutorial.html
The example found here works well !

Mongoid 4 finding embedded documents by ID

I have a project that is my first serious dive into Mongoid.
I saw a tip to use the following command:
Parent.where('childrens._id' => Moped::BSON::ObjectId(params[:id])).first
But this doesn't work. Error message was:
NameError: uninitialized constant Moped::BSON
I found that BSON is no longer included, so I added it to my Gemfile, as well as Moped. Then, I did another fix I found (placing Moped::BSON=BSON in application.rb).
This still didn't work, but the error changed to:
NoMethodError: undefined method `ObjectId' for BSON:Module
So I am assuming that this method got deprecated or something. Does anyone have any other tips?
Just to be clear, I am finding myself in the situation where I want to sort embedded documents using jquery-sortable. This requires me to update them in the database, but the serialize from that doesn't include the parent document in the hash. So I figured I'd try to get it on the back end using an ID from the embedded document. That is why I need it.
Thanks again for any help you can provide.
Try simply:
Parent.where('childrens._id' => params[:id]).first
I have solved the question though this won't be of much help to people in the future. The requirements have changed and now I am using human-readable strings as IDs to assist in friendly URLs and some other stuff.
Therefore, I don't have any issues with ObjectIds. Cortex's solution should (from what I have read) work for dealing with ObjectIds but I cannot verify it now.

cakePHP, encoding problem when using find+list, no problem when using find+all

Well, I've configured the database.php file, added the 'encoding'=>'utf8' option.
also added the $this->charset('utf8') to my view.
Now, when I use the find('list') and echo its content I get those known question-marks. But, when I use the find('all) method, the data is delivered correctly.
And my questions are:
Why?
Who is to blame?
How to solve ?(I really prefer the list way..)
Should I drink more coffee?
can you try $this->find('all') and then use set to extract the values, like Set::extract('/Post/title', $posts); and print it out. if the find all was good and the set::extract is bad there could be a bug. If it works like normal then there is something weird as that is what the core does.

How to set a template for a new issue in Redmine?

The goal is to make users be more specific when reporting a bug.
Ususally I get a messy report "It doesn't work, please help ASAP!" from a user, so I keep asking the same questions each time -- "The why, the who-what-when, the where, and the how..."
Instead, I want to set a template for a new issue, something like this:
What page did you go? What login did you use?
What did you see?
What did you expect to see?
Why do you think this is a bug?
or whatever.
Is it possible?
This plugin would be very helpful, in your case,
Issue Templates- http://www.redmine.org/plugins/issue_templates
here is a patch for templating issue descriptions. anything beyond that is still underway, and is relevant to the issue mentioned above.
http://www.redmine.org/issues/2931
The link below says that you can for the last year or so:
http://www.redmine.org/issues/1138
But I haven't yet found a description of how this functionality is used. I guess I'll have to slog through some code to find out.
Maybe a possible workaround is to have an issue to use as a template.
Create an issue like this:
name: Bug template
description:
What page did you go?
What login did you use?
What did you see?
What did you expect to see?
Why do you think this is a bug?
Then you can duplicate it each time you need a real issue.
The limit is with issues with subtasks. If you duplicate the parent issue you don't get the subtasks duplicated as well.