Bazaar locks in Windows - windows-7

I am new to Bazaar, but that's what is being use at my new job right now. I have installed the latest stable version 2.5.1 on my Windows 7 x64 machine and I can't seem to get it to work.
Every single operation I make, either with the command line tools or the GUI tools end up with the same result. An error window pops up to tell me the program could not acquire a lock.
Every time, the application I'm using will freeze for about 10 seconds, then this shows up and if I click Ignore, nothing happens. My changes are not saved and nothing is applied. If I choose to close the app, I lose all my changes. It even does that when I click the red X to close the application.
In the command line, I try to init a repository and I also get a lock error, but it's different this time. There's an error with a lock inside the repository I'm trying to create.
I just can't figure it out at all and I need help.
The version of Bazaar I'm using is 2.5.1 with the bundled Python v2.6.6 and Tortoise BZR.

I've installed bazaar in cygwin instead and have been using that for a couple of days now. But, to be able to use the GUI tools, I had to do a couple of tricks. I got them to work and here's what I did. It's a workaround if anybody else is stuck with the same issue. Basically here's what I did.
Through the Cygwin setup, install the following packages:
bzr
python3
python3-pyqt4
python-pyqt4 (I wasn't sure which one to install, so I installed both, but I think this one is not necessary.)
xinit
libqt4core (I think, but I'm not sure. Can't remember if I had to install it or if it was installed as a dependency with python3-pyqt4.)
Then download the individual Windows packages for the bazaar plugins you want to use. In my case I downloaded:
qbzr
bzrtools
bazaar explorer
I installed the plugins under c:\bazaar and the installers put them under C:\Bazaar\2.0\plugins.
In a Cygwin terminal, in my home dir, I created the directory ~/.bazaar/plugins/ and in that directory I made a sym link of every directory under C:\Bazaar\2.0\plugins.
After that, in the cygwin terminal, start up a new X-server using the startxwin command. Then export the DISPLAY variable so that your graphical tools know which X session to output to.
$ export DISPLAY=:0.0
Also, in case you get the annoying xterm when you start X, just create an empty file called .startxwinrc in your home directory.
Then, when you enter the commands bzr qlog, bzr explorer, bzr qbzr, the tools should open up through the X server and show up on your desktop. If any dependencies are missing, you will get an error message and you can install the missing package through Cygwin setup.
After that, if you want to use your favourite windows merge tool and editors with bazaar in Cygwin, they won't be able to interpret the Cygwin paths. So instead, I created a ~/bin/ folder and made a few scripts that call my favourite apps and that translate the file paths given as arguments using cygpath -w. Here's an example for p4merge:
#!/bin/bash
if [ "$#" = "2" ]; then
this=`cygpath -w $1`
other=`cygpath -w $2`
/cygdrive/c/Program\ Files/Perforce/p4merge.exe $this $other
elif [ "$#" = "4" ]; then
base=`cygpath -w $1`
this=`cygpath -w $2`
other=`cygpath -w $3`
result=`cygpath -w $4`
/cygdrive/c/Program\ Files/Perforce/p4merge.exe $base $this $other $result
else
echo "Invalid number of arguments."
echo "Usage: p4merge.sh <this> <other> or p4merge.sh <base> <this> <other> <result>"
exit 1
fi
I configured my bzr explorer to use that as a diff viewer and merge tool and it works perfectly.

Old question but I got the same error today. I solved it by simply deleting the content of the directory "C:\Users\{username}\AppData\Roaming\bazaar\2.0\lock"
Happened on a Win 7 x64 machine

Related

Is it possible to use fzf (command line fuzzy finder) with windows 10 git-bash?

I downloaded the .exe file and placed it into my PATH variable. fzf seems to work in command prompt. But I would like to use it in git-bash. When i use fzf in git-bash it seems to start but nothing happens.
Any advice would be helpful. I'm trying to save myself some keystrokes.
Yes it is.
I just downloaded fzf.exe from fzf-bin, launched bash.exe, and typed ./fzf.exe
But for that, I use a simplified PATH first:
set PATH=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\
set GH=C:\path\to\git
set PATH=%GH%\bin;%GH%\usr\bin;%GH%\mingw64\bin;%GH%\mingw64\libexec\git-core;%PATH%
With that PATH, fzf just works.
I know this question was a while ago, but hopefully I can be of some use for any new readers trying to get fuzzy finder working, in git-bash
For whatever reason, I had tried the package from the GitHub repo #VonC shared and the new repo linked thereof and neither package executed in terminal as expected - Only thing could do was fzf --help
As you know git-bash is based on MSYS2, and they have pacman to install packages and a package list can also be found here https://packages.msys2.org/package/ including a fuzzy finder, however not fzf, but fzy
To get the Windows compatible file, go straight to 'File', not the upstream URL and within the downloaded compressed file you will find the .exe
Move that .exe to your git-bash /usr/bin and either rename fzy.exe to fzf.exe or bash alias fzf to execute fzy

Git difftool not launching external DiffMerge program

I've been following the directions in the "blog entry by Dave" link in this answer as I'm on Windows 7 and do use SourceGear's DiffMerge tool. I've added the git\cmd directory to my PATH system variable and put my git-diff-diffmerge-wrapper.sh file in there:
#!/bin/sh
"C:\Program Files\SourceGear\Common\DiffMerge\sgdm.exe" "$1" "$2" | cat
(Yes, it's the correct path for DiffMerge.)
I've edited my .gitconfig file to include the diff and difftool chunks (I copied the lines directly from the post, and he does leave in the commented-out #external line. I added this to the end of my file; is that OK? )
[diff]
# external = git-diff-wrapper.sh
tool = diffmerge
[difftool "diffmerge"]
cmd = git-diff-diffmerge-wrapper.sh "$LOCAL" "$REMOTE"
So I go to git bash and do git difftool HEAD~ 67b8679 -- js/site/pizzabuilder.js and hit enter. Nothing happens. If I do git difftool HEAD~ 67b8679, leaving off the file I want, I get this:
Viewing: 'js/angular/hutlovers/hutlovers.js'
Launch 'diffmerge' [Y/n]: Y
C:\Program Files (x86)\Git/libexec/git-core/mergetools/defaults: line 17: git-diff-diffmerge-wrapper.sh: command not found
Viewing: 'js/angular/localization/StoreListCtrl.js'
Launch 'diffmerge' [Y/n]: n
Viewing: 'js/pizzahut/site/browser_version.js'
Launch 'diffmerge' [Y/n]: n
Viewing: 'js/pizzahut/site/dashboard.js'
Launch 'diffmerge' [Y/n]: n
It continues for all of the files that are different between the commits, but it never launches DiffMerge. I don't know how to interpret the error; what command is not found? difftool? I'm running 1.7.11 in git, and difftool is supposedly included with git starting with version 1.6.3.
When I look at line 17 of the file referenced in the error, this is what's there:
( eval $merge_tool_cmd )
as part of this block:
diff_cmd () {
merge_tool_cmd="$(get_merge_tool_cmd "$1")"
if test -z "$merge_tool_cmd"
then
status=1
break
fi
( eval $merge_tool_cmd )
status=$?
return $status
}
Can anyone help me out? I'm a daily user of git, but hardly a power user, and I know nothing about Windows shell scripts, so following the directions in that post is pretty much the limits of my knowledge at this point.
I know this is an old question and I recognize that my situation may just be me being dumb, but I did spin my wheels trying to figure this out. Hopefully though, someone who made the same mistake as me won't be completely lost in future.
Make sure items show with git diff!
I had a very simple one line change. Did a git add . and then got interrupted. Came back to finish up and decided to double check the diffs. I did not realize that doing a git add would stop me from being able to use git difftool.
Doing a git reset allowed git difftool to work.
DiffMerge
Not sure if this well help, but this is my configuration for difftool with DiffMerge. Note that I'm using msysgit Bash (not sure if it will be different for Cygwin or PoshGit users):
[diff]
tool = dm
[difftool "dm"]
cmd = C:/Program\\ Files/SourceGear/Common/DiffMerge/sgdm.exe \"$LOCAL\" \"$REMOTE\"
I'm currently using Git 2.0, but I seem to recall having set this up with either Git 1.8.x or maybe even as early as Git 1.7.x, so try it out and see if it works.
Bonus with Beyond Compare 3 Pro
I actually do most of my diffing on Windows nowadays with Beyond Compare 3 Pro, though sometimes I will still use DiffMerge. Here are all of my difftool settings if you want to make the switch:
[merge]
tool = bc3
[diff]
tool = bc3
[difftool "dm"]
cmd = C:/Program\\ Files/SourceGear/Common/DiffMerge/sgdm.exe \"$LOCAL\" \"$REMOTE\"
[difftool "bc3"]
cmd = "\"c:/program files (x86)/beyond compare 3/bcomp.exe\" \"$LOCAL\" \"$REMOTE\""
[mergetool "bc3"]
cmd = "\"c:/program files (x86)/beyond compare 3/bcomp.exe\" \"$LOCAL\" \"$REMOTE\" \"$BASE\" \"$MERGED\""
None of the other answers worked for me. I finally got diffmerge to work on Windows 7,8,10 using Git 2.6.3, 2.7.0
1) Make sure you can write to and use your global .gitconfig stored at ~/.gitconfig, which is relative to your HOME path.
Use:
git config --global --edit
or just navigate to the file in a windows explorer and edit it that way.
The HOME variable can be set by navigating to environment variables within windows (for 7, right click on Computer-->Properties-->Advanced system settings-->Environment Variables).
2) Make sure diffmerge is in your PATH variable on your machine. This is in the same place as the HOME variable.
I added this to my PATH:
C:\Program Files\SourceGear\Common\DiffMerge;
3) To make diffmerge the default add the following to your global .gitconfig file:
[merge]
tool = diffmerge
[mergetool]
prompt = true
[mergetool "diffmerge"]
path = C:\\Program Files\\SourceGear\\Common\\DiffMerge\\sgdm.exe
'\' is an escape character
repeat for difftool stuff and that's all I needed to make it work. No wrapper script or local remote variables were needed.
SourceTree Users: This could be your problem.
One possibility for SourceTree users encountering the problem described in this question: If you are having this problem from right-clicking in SourceTree and launching external merge tool (which internally runs something along the lines of git mergetool sourcetree), there is a SourceTree bug that causes it to hang when you are resolving a conflict where one side of the file has been deleted.
This is further complicated by the fact that SourceTree's UI does not clearly indicate that the reason for the conflict is that the file was removed on one side or the other.
You can confirm this by opening a terminal and running:
git mergetool
You'll see something like the following:
Deleted merge conflict for 'Stuff/Other/Thingamajig.js':
{local}: modified file
{remote}: deleted
Use (m)odified or (d)eleted file, or (a)bort?
This kicked my butt for over an hour, during which I ended up on this SO question, so I'm leaving my findings in this answer to help out the next poor soul that might fall victim to this bug.
(If you do encounter this issue, please consider following the link above and vote on the SourceTree bug so Atlassian will get a sense of the scale of this issue's impact.)
It seems to me that the problem is that the path that git bash is using is not the one that Windows is using. I checked that by running env | grep PATH from within git bash.
I understand you don't want to mess with the git installation, so I suggest that you give the complete path to your wrapper.
You have to give it using the cygwin format. How to do that?
1) Go to the place, where you have the wrapper, and run Git Bash there.
2) In the Git Bash window type pwd, which will show you current working directory. Right-click on the window title and select Mark. Using mouse select the path (in my case it's /C/Users/lpiepiora/cmds and hit Enter.
3) Now edit your .gitconfig and add the copied path to it (you have to add an extra slash at the end of the copied path).
After that steps, you should be able to launch your merge tool.
PS. You may want to change your git-diff-diffmerge-wrapper.sh to something along these lines, to handle properly removed / added files, as it was suggested in an answer to another question.
#!/bin/sh
NULL="/dev/null"
if [ "$2" = "$NULL" ] ; then
echo "removed: $1"
elif [ "$1" = "$NULL" ] ; then
echo "added: $2"
else
echo "changed: $3"
"C:\Program Files\SourceGear\Common\DiffMerge\sgdm.exe" "$1" "$2" | cat
fi
[diff]
tool = meld
[difftool]
prompt = false
[difftool "meld"]
cmd = "\"C:\\Program Files (x86)\\Meld\\Meld.exe\" \"$LOCAL\" \"$REMOTE\""
adding to the above answers. This is my git config for windows for making meld as diff tool
be careful with the "

Using SVN on Windows with Cygwin and TortoiseSVN

I'm quite a beginner with version control so I might be doing something very wrong.
I want to be able to access a local repository both in cygwin and in TortoiseSVN (or other Windows app). The trouble is, in cygwin I have to use the
file:///cygdrive/c/... paths while TortoiseSVN needs
file:///c:/....
How can I make these two work together? Can I use some other path/protocol that both understand?
Thanks!
Easy way is to use the svnserve program that comes with Subversion. This should be in Cygwin. All you need to do is start up the svnserve and use svn:// as the protocol instead of file://.
First, you need to modify your repository. You'll have to edit two files: svnserve.conf and passed.
$ cd /cygdrive/c/.../repos_dir
$ cd conf
$ vi svnsever.conf # Change the "# password-db = passwd" line & remove the "#"
$ vi passwd # Setup the user and password entry
Next, you start the server:
$ cd .. # Back to the repository directory
$ svnserve -r $PWD -d
And, that's it.
Now, you can do your checkout this way:
$ svn co svn://localhost/dir/to/check/out
This will be the same URL in both cygwin and in Tortoise
WORD 'O WARNING
There is no guarantee that different subversion clients will produce working directories that will work with other subversion clients.
Fortunately, Tortoise and the standard Subversion command line client seem to be okay. I've been able for the last few years to switch between the Subversion command line client and ToroiseSVN. HOWEVER, you do have to make sure that they're both ether post version 1.7 clients or pre 1.7 clients. If your Cygwin client is version 1.6.7 and your Tortoise client is 1.7.5, you can't share the working directory. Use the svn version command to check your Cygwin client, and check the About Box on Tortoise.
Again, there's no guarantee that both clients can share the same working directory, so if there are problems, you are on your own.
There is a better way. Simply link the directory.
ln -s /cygdrive/c /C:
now it should work.
Credit goes to Mark Malaknov
You can read it here:
http://markmal.blogspot.com/2012/11/how-to-use-cygwin-svn-and-tortoisesvn.html
If you (re-)install TortoiseSVN and select the option to install the (Windows) command-line tools, but don't install the Cygwin/Linux version of these tools from the Cygwin installer (or remove them), then your Windows tools will still be available via Cygwin.
These should accept Windows paths as if you were invoking them from the Command Prompt (although you might have to put them in quotes to avoid the bash shell from interpreting them)

Git with SSH on Windows

I've went through the excellent guide provided by Tim Davis which is about configuring Git to work with SSH under Windows in order to produce a Git Server in order to have a main place for my DVCS.
I am in the process of creating a clone for my project. I’ve went through all the steps till this point, but I keep getting this from TortoiseGit:
git.exe clone -v “ssh://Administrator#127.0.0.1:22/SSH/Home/administrator/myapp.git” “E:\GitTest\myapp”
bash: Administrator#127.0.0.1: command not found
Initialized empty Git repository in E:/GitTest/myapp/.git/
fatal: The remote end hung up unexpectedly
Success
and nothing gets cloned.
BTW: The TortoisePLink comes up just before this message appears and asks me: “login as:” ( I thought that this info is given in the command, i.e: Administrator#blahblah.
My home variable is set to the correct place:
From a Git Bash shell:
echo $HOME
/c/SSH/home/Administrator
I’ve also tried using Putty’s plink instead of TortoisePLink (in both Git’s and TortoiseGit’s installation). This time the error was narrowed down to:
git.exe clone -v “ssh://Administrator#127.0.0.1:22/c:/SSH/Home/administrator/myapp.git” “E:\GitTest\myapp”
Initialized empty Git repository in E:/GitTest/myapp/.git/
fatal: The remote end hung up unexpectedly
I fought with this problem for a few hours before stumbling on the obvious answer. The problem I had was I was using different ssh implementations between when I generated my keys and when I used git.
I used ssh-keygen from the command prompt to generate my keys and but when I tried "git clone ssh://..." I got the same results as you, a prompt for the password and the message "fatal: The remote end hung up unexpectedly".
Determine which ssh windows is using by executing the Windows "where" command.
C:\where ssh
C:\Program Files (x86)\Git\bin\ssh.exe
The second line tells you which exact program will be executed.
Next you need to determine which ssh that git is using. Find this by:
C:\set GIT_SSH
GIT_SSH=C:\Program Files\TortoiseSVN\bin\TortoisePlink.exe
And now you see the problem.
To correct this simply execute:
C:\set GIT_SSH=C:\Program Files (x86)\Git\bin\ssh.exe
To check if changes are applied:
C:\set GIT_SSH
GIT_SSH=C:\Program Files (x86)\Git\bin\ssh.exe
Now git will be able to use the keys that you generated earlier.
This fix is so far only for the current window. To fix it completely you need to change your environment variable.
Open Windows explorer
Right-click Computer and select Properties
Click Advanced System Settings link on the left
Click the Environment Variables... button
In the system variables section select the GIT_SSH variable and press the Edit... button
Update the variable value.
Press OK to close all windows
Now any future command windows you open will have the correct settings.
Since this keeps coming up in search results for making git and github work with SSH on Windows (and because I didn't need anything from the guides above), I'm adding the following, simple solution.
(Microsoft says they are working on adding SSH to Visual Studio, and GitHub for Windows still doesn't support SSH...)
1. I installed "git for Windows" (which includes ssh and a bash shell)
https://git-scm.com/download/win
2. From the included bash shell (which, for me, was installed at: C:\Program Files\Git\git-bash.exe)
cd to the root level of where you want your repo saved (something like: C:\code\github\), and
Type:
eval $(ssh-agent -s) && ssh-add "C:\Users\YOURNAMEHERE\.ssh\github_rsa"
3. Type: (the SSH link from the repo)
git clone git#github.com:RepoName/Project.git
you are using a smart quote “ instead of " here:
git.exe clone -v “ssh://
^^^
Make sure you use the plain-old-double-quote.
I've found my ssh.exe in C:/Program Files/Git/usr/bin directory.
If Git for windows is installed, run Git Bash shell:
bash
You can run ssh from within Bash shell (Bash is aware of the path of ssh)
To know the exact path of ssh, run "where" command in Bash shell:
$ where ssh
you get:
c:\Program Files\Git\usr\bin\ssh.exe
I was trying to solve my issue with some of the answers above and for some reason it didn't work. I did switch to use the git extensions and this are the steps I did follow.
I went to Tools -> Settings -> SSH -> Other ssh client
Set this value to C:\Program Files\Git\usr\bin\ssh.exe
Apply
I guess that this steps are just the same explained above. The only difference is that I used the Git Extensions User Interface instead of the terminal. Hope this help.
When I typed where ssh it showed me multipe ssh.exe
user#pc MINGW64 /c/dev/
$ where ssh
C:\Users\user\AppData\Local\Programs\Git\usr\bin\ssh.exe
C:\Windows\System32\OpenSSH\ssh.exe
Deleting / moving these exe helped:
# copy from
# C:\Users\user\AppData\Local\Programs\Git\usr\bin
# to something like
# C:\Users\user\AppData\Local\Programs\Git\usr\bin\backup-ssh
ssh-agent.exe
ssh.exe
ssh-add.exe
This solved the issue for me.

Why can't Cygwin CVS read the CVS password file in a Ruby/Perl script?

On the Windows command line and cygwin bash I can execute the following without problems:
cvs login
cvs -Q log -N -rVersion_01_00
A ruby script in the same directory contains the following:
`cvs login`;
`cvs -Q log -N -rVersion_01_00`;
When I execute the ruby script on the Windows command line I get the following error:
cvs log: warning: failed to open /cygdrive/c/Documents and Settings/za100744/.cvspass for reading: No such file or directory
If I run the script in a cygwin bash shell I get the same output I would as when I type in the commands manually.
I have no idea as to what is going wrong. The path generated by the Ruby script is wrong since it is a cygwin path but it works correctly directly on the command line. I use cvs that came as part of cygwin:
which cvs
cvs is an external : C:\cygwin\bin\cvs.exe
Ruby is the one-click installer version:
which ruby
/cygdrive/c/Ruby/bin/ruby
It seems like cvs under Ruby can not resolve /cygdrive/c to c: but works OK from the cmdline.
Perl gives me exactly the same problem.
my $str = "cvs -Q log -N -r$cvs_tag|";
open(CVS_STATUS, $str) or die "\n##ERROR##";
It looks like either CVS can't create the file, or your path is wrong. Does the file .cvspass exist? If not, this page suggests you try creating an empty .cvspass file and then run your command. e.g. do
touch ~/.cvspass
If this doesn't help, then the problem is probably path related. There are a few possibilities; $HOME not set correctly, your home dir not matching what's in \etc\passwd, etc. See this tutorial for some troubleshooting steps that should help pin down the problem.
Using a windows native compiled CVS solves the problem. It is not ideal since I have to send a cvs executable with the script for users that has cygwin CVS but its better than nothing.
We had several problems with unix-, mixed- and windows-style paths in cygwin based perl scripts and built-in tools such as rsync. E.g. rsync can't handle wind-style paths. Use the tool "cygpath.exe" to adjust them correctly. Maybe it's the cause.

Resources