Showing posts with label murky mercurial. Show all posts
Showing posts with label murky mercurial. Show all posts

Sunday, April 7, 2013

The -mno-cygwin option has been deprecated for years

[UPDATE: 2015-03-19] Yay! Issue #12641 was closed in September-2013, and the latest releases of Python>=2.7.6 no longer have it.

So true. And there's even a bug filed in Python tracker. I also talked about it in this post. Here's how they deal with it in Mercurial (a.k.a. Hg).

# the -mno-cygwin option has been deprecated for years
Mingw32CCompiler = cygwinccompiler.Mingw32CCompiler
class HackedMingw32CCompiler(cygwinccompiler.Mingw32CCompiler):
    def __init__(self, *args, **kwargs):
        Mingw32CCompiler.__init__(self, *args, **kwargs)
        for i in 'compiler compiler_so linker_exe linker_so'.split():
            try:
                getattr(self, i).remove('-mno-cygwin')
            except ValueError:
                passcygwinccompiler.Mingw32CCompiler = HackedMingw32CCompiler

Thursday, March 29, 2012

hg-git and TortoiseHg

[UPDATE 2013-05-28] Make sure your hg-git is up to date and pointing at the most recent tag. I have had issues when I have updated hg but not pulled the latest hg-git changes from durin42.

If for some reason you were using Mercurial, aka Hg, and you needed to interact with Git, then you probably have heard about hg-git. There are other tools, but I think this one is the oldest, and even though not necessarily the best, it works fine. Now if you are on Windows, then you are most likely using TortoiseHg, aka thg, and if so integrating hg-git is a snap. The only confusion is that there are multiple website with seemingly different information. If you already have TortoiseHg installed, all you have to do is follow the directions in the TortoiseHg v2.1.1 Documentation: Section 9.3: Use with other VCS systems: hg-git (git). There are some key differences between this documentation and what you will find on various other websites which are geared toward non-TortoiseHg users. In particular, hg-git requires Dulwich, a python-git implementation, but note what it says in the thg docs:
Current versions of TortoiseHg include dulwich version 0.7.0. We recommend to use hg-git version 0.2.6 with this version of dulwich and Mercurial 1.8.
So you don't need to install Dulwich if you are using hg-git with TortoiseHg! This is intended for non-thg users.

Now on to use:
  1. Make sure that you have enabled the plugin by adding the [extension] line hggit = C:\hg-git\hggit to your mercurial.ini file, which can be found in your user-profile folder (the one with your Windows user name). This is described in all of the websites, but most of them use the Linux/Unix home folder ~/.hgrc which you will NOT find on a windows machine unless you are using Cygwin or minGW/MSYS. For thg installations of Mercurial, the %USERPROFILE%\mercurial.ini file is the equivalent of the Linux ~/.hgrc file.
  2. Branches should to bookmarked before you can push them to a git repo. Basically this is how hg-git deals with branches. A Git branch is the equivalent of an hg bookmark. This is because branches in Mercurial and Git are different. You can do this manually by issuing the command hg bookmark -r default master. That basically maps the hg branch called default to the git branch called master, by creating an hg bookmark also called master. The -r allows you to specify the revision (could be an hg branch, bookmark or tag), instead of pointing to the current working copy. For example if you have an hg branch named x64 if you want to push it to a Git repo, make a bookmark, hg bookmark -r x64 x64_git; note that in Mercurial branches and bookmarks cannot have the same name. There is an hg-git extension you can add that will remove the suffix, but a better practice might be to use bookmarks instead of named branches in Mercurial.
  3. Finally to push to your git repo use hg push git+ssh://git@github/user/repo. Note that protocol "git+ssh://" and the switch from colon to slash between github and user! That tells hg-git to push to a git repo using ssh. Also you will need to enable Pageant, you can find it in the thg folder in program files. You will need an ssh key. If you don't already have one, you can download puttygen and follow the directions on Bitbucket: Using the SSH protocol.
That's it. You don't need to enable the bookmarks extension, because it became part of Mercurial core 1.8. There is an issue with author, you want to make sure that you are commiting with the same username. You can set that in either mercurial.ini globally or in .hg/hgrc per repo. Alternately select thg settings and commit. But not setting this is NOT a show stopper.

Monday, January 9, 2012

Git Windows is so easy!

[UPDATED 2014-10-07] For a pure msysgit experience, check out Basic Git Work Flow.
[UPDATED 2013-04-11]
I feel I should update this site since it is so hopelessly out of date.
I got Git up and running on an XP with shell integration, and linked to my remote in under 15 minutes, and that's only because I got up to get a cup of water. Now I have it running on my Windows 7 x64 machines as well. As the msysgit project has matured, it has gotten even easier. And there are more Git clients now as well. Git is the most widely used distributed version control system and not just for source control management tool, even writers and others are using it. Why? GitHub, Bitbucket, Gitorious, CodePlex and others all host online Git repositories. Mercurial is also a very popular dvcs.

Here are some notes I took of my process. I'll clean it up later:

mysysgit

There is really no need to read any of these other than Scott Chacon's Pro Git book.
  1. For more info. Read: Github Help: Set up Git , SparkFun: Using GitHub with Windows , Sergio Pereira » Git, SSH, PuTTY, GitHub, Unfuddle, the kitchen sink, and An Illustrated Guide to Git on Windows. Lots of good reading material on this subject now.
  2. Goto:  msysgit.
  3. Download and install msysgit. Note: if you use GitHub for Windows, you can skip this step as Git is installed for you.
  4. Leave all settings the same except: uncheck git-cheetah and select Git Bash Here and Git GUI here instead.
  5. You might prefer git-cheetah or git-extensions, but they are basically clones of gitk and git-gui which you will already have. They just add shell extensions, which msysgit also already has: git-bash (a bash console) and git-gui. TortoiseGit and GitHub for Windows will also add shell extensions.
  6. This part is really irrelevant. GitHub says it will not work with plink/putty ssh keys, which is the default in TortoiseGit, but I’ve seen numerous posts that say it does, maybe the docs are out of date. Also TortoiseGit will give you the option to use Git's SSH client, but claim Putty/Plink works better on Windows. Also since all 3 Tortoise projects share libraries, chances are if you have TortoiseSVN or TortoiseHg you already have Plink.

Git Clients TortoiseGit

In addition to TortoiseGit there is also Github for Windows and Atlassian's SourceTree. There are even more Git clients listed on the Git websiteFor now I would still recommend against GitHub for Windows, as it is helplessly stoopid. For TortoiseSVN users - I would recommend sticking with TortoiseGit. Either way you will find with Git, the command line is somehow irresistible.
  1. Install TortoiseGit. Look at the downloads and grab the latest version for your machine, either x64 or x86.
  2. Stick with Plink/Putty; and let’s see if it just works.
  3. You may need to restart, or you may not. Restart, yay! It works (and even better than tortoiseHg, I might just uninstall that since it only works best on Windows - there's a problem with the windows api’s that cause the sub-context menu items to appear off the left edge of the menu - I'm going to take a look into that.)

PuttyGen

  1. GitHub only uses ssh and https (Bitbucket also uses ssh and https), so you only need to do this for GitHub or if you want to use ssh, which is cooler so why wouldn't you.
  2. Do you already have a key pair generated? Look for a .ssh folder.
  3. Create a key: programsàtortoiseGitàputtyGenàgenerate
  4. make sure that you do not already have %userprofile%.ssh folder, click show hidden files in folder options, or in cmd shell use dir .* to list all dot folders.
  5. Save keys in %userprofile%\.ssh (you need to make this directory in cmd shell, mkdir .ssh
  6. Copy the text in the window of your public key and paste in a file, this is what you will paste into GitHub or Bitbucket.

Shell

Have a look at Console2 by bozho - it's my favorite! Also set up Meld as your diff/merge tool, beyond sweet!

Success!

More links on ssh/putty

  1. Just the last part: Bitbucket Documentation: Set up SSH for Mercurial
  2. Didn’t read this: TGit wiki: UsingPuTTY

Fork me on GitHub