meld: Make one part read only - merge

Up to now I used emacs ediff mode for merging. I tried meld, but could not find a way to make one buffer/file read only. I never merge in two directions, that's way I make one part read only before merging.

The "Merge mode (in development)" section on the meld features page calls this Lock down and that kind of functionality doesn't seem to be released yet, beside it not being clear if this can be used outside of merge mode. ( status 2020-08 )
WHat you can do is make the file you don't want to change (temporarily) read-only.
That will give you a lock-icon and a grey-ed out "Save file in this pane" icon next to your filename, and you cannot edit the file in that pane.

This article can help you I believe. It says
[merge]
tool = mymeld
[mergetool "mymeld"]
cmd = meld --diff $BASE $LOCAL --diff $BASE $REMOTE --diff $LOCAL $MERGED $REMOTE
This is what I call traditional two-way merge with tabs. Now, since I
already noted Meld supports three-way merging, there is another
option. When “diff3” git conflict style is set, Meld prints “(??)” on
the line showing the content from BASE. In this mode, LOCAL and REMOTE
files are read-only which is also handy.

Related

VS Code alternative to webstorm's "find usages"

In WebStorm there's a really nice feature that you can right-click a file and choose "Find usages...", what would output all the files and all the line numbers in the project where that file is referenced (e.g. where path to it is specified as a string in JS require).
I really love that feature, since it's very useful for refactoring - before I delete or edit smth I might want to find usages first to get clear understanding of what other things would be affected.
Is there a way I could do the same thing with VS Code?
Are there alternatives to Webstorm's "Safe delete" (when deleting a file it looks for usages first and shows a warning if there're some) and rename - so if I rename e.g. foo.js to bar.js all references to it in the project (e.g. paths within require) would be automatically updated?
Unfortunately there are no built in ways to do this in VS Code and I don't know of any extensions to do this, either.
Actually you can open the helper console ( Cmd + Shift + P in mac and the shortcut is Shift + F12) and go to find all usages

How to force filename completion under oh-my-zsh?

The problem:
Sometimes, when I try to do things in zsh, it won't complete the filenames I want because they don't apply to the current context. Two examples:
I want to force-add a file which is currently ignored in hg or git. oh-my-zsh tries to help me by only completing non-ignored files, but in this case it is a hindrance. I'm forced to type the full path to the file manually.
I want to use git diff to diff two arbitrary files on my hard drive. These files do not reside in any repository, but who cares?! git diff --no-index is a really nice way to diff any two files. But because they aren't in a repo, zsh won't complete them.
The proposed solution:
I could simply edit the source control context to complete all filenames, regardless of their source control status. But there are a couple limitations:
I don't know how to do that.
It might be nice to have an "escape hatch" whereby I could force file completion, no matter what the context.
So, I decided instead to bind a key shortcut to force normal, context-free file completion.
What I have so far:
Zsh apparently has an easy way of doing this, as detailed in this question. So I've added the following lines to my .zshrc:
zle -C complete complete-word complete-files
bindkey '^[[Z' complete
complete-files () { compadd - $PREFIX* }
This causes shift-tab to initiate file completion. It works beautifully in standard zsh! But boo-hoo, for some reason it doesn't work when I source oh-my-zsh. :-(
So is there a way to get this to work with oh-my-zsh, or is there an alternative solution I might find satisfying?
My way of doing exactly that (replacing the default diff command with the one from git) was pretty straightforward.
Add this to your ~/.zshrc:
diff() {
git diff --no-index "$#"
}
Before I was using an alias, but since zsh can "solve" them, it was then using the autocompletion functions from git diff, which inadvertently led to the same problem as you.
Using a function solves this issue as zsh reverts to the classic "files only" completion.

How to partially save merge results?

I'm now in the middle of 3-way merging using ClearCase "Diff Merge" tool, and I want to stop and do the rest tomorrow.
I'm afraid that my machine may halt or restarted, so I want to save the merge results I made so far.
The problem is that the "Save" button is disabled, and it seems that it will be enabled just after I resolve all conflicts.
On the other hand, if I try to close the tool, it warns me that there are unresolved merge points so I could not resume the merge later:
Is that possible somehow to save it right now even before I resolved all conflicts?
Thx
Not that I know of: The merge Windows control allows you to go from unresolved merge to unresolved merge, but not to save a merge in progress.
What I usually do is (if we are talking about the merge of one file, merge in text mode):
save the current resulting merge content (the fourth panel content)
cancel the merge in progress
Then later:
checkout a new version with the saved content (or used the checked out version and overwrite it with the saved content)
merge to that new version (which already contains what I want to see from the part I resolved previously)
Note: if you know that all resulting merge conflicts should be resolved with root (1), ours (2) or "their" (3), you could click on "Navigate > Resolve-and-Advance mode", and quickly click on 1, 2 or 3.

Is there a way to revert a file line by line in P4

I want to revert part of changes in a file. I know in p4v you can easily revert files line by line. I am wondering how to do that using p4 command.
Yes you can, assuming your using the default p4merge utility, follow this procedure:
Right click on the file in your change-list.
Select 'Diff against Workspace file'. (the workspace file is right panel and original is left)
Select 'Edit' from the main top menu.
Select 'Edit right pane'. (a 3rd pane at the bottom will appear which you can edit)
Now browse your changes ...
... To remove a change, click the triangle shape on the right side. (shape icon turns blue)
... To add the change back, click the circle shape on the right side. (shape icon turns green)
Quit the editor and save your changes and your done!
Does that help?
Another option is to force a resolve and then resolve interactively. One way to do this is
Shelve the files you want to partially revert with "revert after
they are shelved" checked
Check shelved files back out in the same changelist
Unshelve files with both "Revert checked out files" and "overwrite workspace files" unchecked. Files will be unshelved
in unresolved state
Resolve files interactively, allowing you to choose which blocks to keep and which to revert
It's not possible to revert line by line using p4. See p4 docs
Consider using any of the following ways to diff:
1) Using vim, try vi -d file1 file2 shows you a graphical difference between the two files
2) Besides Kdiff3, Meld is also popular, pretty nifty graphical interface for diff...Meld
3) Emacs has Ediff
4) If you're looking for something light weight...consider xdiff

Is there any ECB (or other)-enhanced find file mojo?

Can I use ECB (or some other project aware thing, like eproject, ibuffer, etc.) to enhance emacs's find-file goodness?
Imagine this scenario: I have several projects/directories specified in my ecb-source-path, let's call them Project1 and Project2, and they look like so:
Project1
foo.c
bar.c
Project2
foo.c
baz.c
I'd like to have find-file (or another command) work to find and jump to the files there without having to navigate to the ecb directories buffer, or have the buffers open already.
I guess my ideal usage scenario would be like so:
I'd like to C-x C-f baz (or another special command) to open Project2/baz.c. Going even further, I'd love if I could use something like ido's flex matching to get p2foo open Project2/foo.c.
¿C'est posible?
If in your example you are in project1 foo.c, and you want to get to project1 bar.c, I think most of the project tools like ede, eproject, gnu global, idutils integration etc have "jump to file" type commands. I, of course, recommend the CEDET/EDE and ECB combination. The keybinding is C-c . f which is ede-find-file.
Setting up CEDET and EDE is pretty easy, but EDE knows only a small number of different project types, and you may need to configure it for your projects by hand which is less easy.
If you want to be in project1/foo.c and jump to project2/baz.c, you just need to use locate:
M-x locate RET baz.c RET
Now select from the list.
You could use the filecache package to index the directories you want, then use ido to choose a filename from the cache. Here is one example; there are other implementations you can Google for.
Take a look at find-file-in-project. It seems to me you're looking for something similar.
I've written a package find-file-in-tags which enables you to open files in your TAGS file without specifying the path to the file. If there are multiple files that match what you've entered, you're prompted to refine your choice (or open all).
Additionally, if you have multiple work areas for the same project, find-file-in-tags uses a single TAGS file for all those work areas but opens up the file in the same work area as the buffer in which you are invoking find-file-in-tags.