Checkout a file from tig - tig

If i open up tig with another branch:
tig otherBranch
Is it possible to navigate to the tree view find a file that I want and check it out to my current branch?

Yes, you have to add a user-defined command in ~/.tigrc, for example:
bind generic ^F !?git checkout %(commit) %(file)
Then open tig otherBranch, press t to go to the tree view, navigate to the file and press Ctrl-F.

Related

vim-fugitive automatically gdiff on enter from gstatus

When using vim-fugitive if you issue :Gstatus it splits the screen and gives you the would be git commit editor and you can move over different files that have changes and press enter to see them in the other half of the screen. I believe it is like issuing :Gedit .
I then need to issue a :Gdiff manually to split the editor in half and see the side by side diff of the file to review and or stage it.
My question is is there a way to make it automatically go to :Gdiff when I press enter, while my cursor is on a file name that has changes.
Basically trying to save some time when going through a large list of files.
You can use D or dd inside the :Gstatus window to run :Gdiff on the file under the cursor. See :h :fugitive-:Gstatus or use g? inside the :Gstatus window.
For additional help you may wan to look at Vimcasts, which has some very nice fugitive.vim series.
A complement to command line git
Working with the git index
Resolving merge conflicts with vimdiff
Browsing the git object database
Exploring the history of a git repository

unable to use external command in tig

I use git and gitk a lot. Recently, I found some enthousiastic posts about tig and decided to give it a try.
It looks great for viewing the repository, however changing the repo with tig seems difficult if not unworkable.
The problem I am facing is that tig fails to start an editor for external commands, thus making it impossible to continue with the action.
For example, if I select a commit and issue
!git commit --amend
I get a screen saying
vim: Warning: Output is not to a terminal
Only ^C gets me out, thus stopping tig as well.
What can I do to configure this properly for either tig or git in order to get this working?
thanks in advance,
Ruud
The main way to start external commands is via keybindings and what in Tig is referred to as user-defined commands. For example, to amend the last commit you can add the following to ~/.tigrc after which pressing + will put you right into Vim:
bind generic + !git commit --amend
There are several variables for the browsing state, which can be passed to external commands, such as %(commit) and %(branch) as well as %(prompt) for asking for input, for example when creating a branch.
For reference, the !<command> allows to open the output in the pager, for example !git show 3e3abcd and as such is more like Vim's :r!<command>.

Perforce P4V Adding a new file to the depot

I'm new to Perforce but I was able to successfully create a depot with a whole directory tree. Now I'm trying to add a file to one of the folders within that tree and I'm having trouble finding how to do that. I can see the file in the Workspace tab when I navigate through my computer but when I right-click the file there's no option to add it to a Pending Changelist. Appreciate any suggestions. Thanks.
Tony
Edit: I feel like I'm making hash of this thing. So I created a new workspace and located the folder containing the file I wanted to add. Then I right-clicked the file and selected "Mark for Add". Then I went to submit and got this error:
//depot/main/SSRS/1 SQL Code/Voucher Query.docx - warning: cannot submit from non-stream client
No files to submit.
Submit failed -- fix problems above then use 'p4 submit -c 5'.
The previous answer shows how to add a file from the command line, but you were asking how to do it with P4V.
If you right click the file in your Workspace view you should see the option "Mark for Add". You can also use the toolbar button with a small red + sign, 4th from the left.
If the file is in the folder, run:
p4 add foldername/file
Then you can
p4 submit
Your depot is a stream depot (the icon should have "waves" in it...)
Set up a new depot, a "local" one, and use that one.
In my case it just worked by logging off, killing the task in Task Manager and finally re-starting my Perforce.

In Perforce how do you view history of all changelists in repository?

I am not after history of a specific file but of the whole revision tree.
You want just a big list of all changelists?
At the command line:
> p4 changelists
For more detailed output:
> p4 changelists -l
To see more information on a specific changelist:
> p4 changelist [changelistnumber]
In P4V 2009.2 (at minimum) View -> Submitted Changelists allows you to filter the list of all changelists by folder/file, user, or workspace, as shown in the screenshot below:
If you use P4V
View the Submitted Tab in P4V or select the root depot and view the history tab.
if you want to see the history log in p4v just follow the below step.
select the file to which you want to see the history log .
right click on it and select file history.
note :if you want entire history of a file starting from version1.0 to version x.0 just right click on the file and select revision graph as shown in picture.file history in p4v

Perforce - submit only files open for branch, not files open for edit

Quite often when I'm working in a branch in Perforce, I realise I need a file I didn't branch when I initially branched.
So, I add the file to my client, run p4 integrate -b branchname, then p4 submit.
Thing that bugs me is that I then need to go through the list of files for submit, and remove all entries that are open for edit.
I can't see any option in p4 help submit, but it seems like this might be a reasonably common use case.
First do
p4 submit
Assuming your p4 editor is vi,
type this command in command mode
g/#.*edit\|#.*add\|#.*delete/d
You can choice to submit a single file on the command-line.
p4 submit <filename>
Then it won't bug you about the other files.
If you have more than one file, then maybe you should move all of the files you are currently editing onto an numbered changelist, or branch onto a numbered changelist, which will provide the separation you want.
If you're going to do this, it's much easier to manage numbered changelists from one of the GUIs.

Resources