Difference between revisions of "Mercurial/Tips And Tricks"

From Apache OpenOffice Wiki
Jump to: navigation, search
m
Line 1: Line 1:
 
{{Mercurial}}
 
{{Mercurial}}
 
This is the page to add your favorite Mercurial tip.
 
This is the page to add your favorite Mercurial tip.
 +
__TOC__
  
 
= Tips and Tricks =
 
= Tips and Tricks =
  
* After pulling/merging:
+
== After pulling/merging ==
** "hg log --follow-first" is a convenient way to display your CWS changes at the top of the log.
+
* <code>hg log --follow-first</code> is a convenient way to display your CWS changes at the top of the log.
** "hg log --follow-first -P <original_clone_milestone>" will show only the CWS changesets.
+
* <code>hg log --follow-first -P <original_clone_milestone></code> will show only the CWS changesets.
** "hg outgoing" works as well, of course.
+
* <code>hg outgoing</code> works as well, of course.
* Combined diff which contains exactly the changes of your CWS without anything pulled from master
+
== Combined diff which contains exactly the changes of your CWS without anything pulled from master ==
** If your current milestone tag is locally available: hg diff -r <current_milestone_tag>
+
* If your current milestone tag is locally available: <code>hg diff -r <current_milestone_tag></code>
** If your current milestone tag is *not* locally available (might happen, see above):  
+
* If your current milestone tag is *not* locally available (might happen, see above):  
***search for your last pull/merge from the master with "hg log -m"
+
**search for your last pull/merge from the master with <code>hg log -m</code>
*** "hg diff -r <second_parent_of_last_master_merge>"
+
** <code>hg diff -r <second_parent_of_last_master_merge></code>
** Alternatively, if you just did a pull/merge from master: "hg export --switch-parent tip"
+
** Alternatively, if you just did a pull/merge from master: <code>hg export --switch-parent tip</code>
* The default output format of some commands does not suit you? Use styles:
+
== Styles ==
**"hg log --style=compact"
+
The default output format of some commands does not suit you? Use styles:
**"hg outgoing --style=changelog"
+
*<code>hg log --style=compact</code>
 +
*<code>hg outgoing --style=changelog"</code>
 
* Or create your own format with the template engine:
 
* Or create your own format with the template engine:
**"hg outgoing --template '{date|shortdate} {author|person} {desc}\n' --newest-first"
+
** <code>hg outgoing --template '{date|shortdate} {author|person} {desc}\n' --newest-first</code>
* Accessing repository over ssh using Tortoise Hg on Windows
+
** If you want to use the ssh client of your Cygwin shell (and also ssh-agent), add the following to the [ui] section of your mercurial.ini: ssh = ssh -C
+
 
+
=Mercurial on Windows/cygwin=
+
  
 +
== On Windows/cygwin ==
 +
=== Using TortoiseHg in Cygwin ===
 
Depending on the cygwin version, using cygwins hg (and other tools) sometimes fails. TortoiseHg (http://bitbucket.org/tortoisehg/stable/wiki/Home) can be used as alternative.
 
Depending on the cygwin version, using cygwins hg (and other tools) sometimes fails. TortoiseHg (http://bitbucket.org/tortoisehg/stable/wiki/Home) can be used as alternative.
  
Line 33: Line 33:
  
 
For the graphical interface of TortoiseHg Putty's pageant is the default ssh key provider. TortoiseHg allows easy graphical access to hg repositories within the Windows Explorer.
 
For the graphical interface of TortoiseHg Putty's pageant is the default ssh key provider. TortoiseHg allows easy graphical access to hg repositories within the Windows Explorer.
 +
==== Accessing repository over ssh ====
 +
* If you want to use the ssh client of your Cygwin shell (and also ssh-agent), add the following to the [ui] section of your mercurial.ini: ssh = ssh -C

Revision as of 00:01, 27 October 2009

Mercurial.png

Mercurial

Quick Navigation

About this template


This is the page to add your favorite Mercurial tip.

Tips and Tricks

After pulling/merging

  • hg log --follow-first is a convenient way to display your CWS changes at the top of the log.
  • hg log --follow-first -P <original_clone_milestone> will show only the CWS changesets.
  • hg outgoing works as well, of course.

Combined diff which contains exactly the changes of your CWS without anything pulled from master

  • If your current milestone tag is locally available: hg diff -r <current_milestone_tag>
  • If your current milestone tag is *not* locally available (might happen, see above):
    • search for your last pull/merge from the master with hg log -m
    • hg diff -r <second_parent_of_last_master_merge>
    • Alternatively, if you just did a pull/merge from master: hg export --switch-parent tip

Styles

The default output format of some commands does not suit you? Use styles:

  • hg log --style=compact
  • hg outgoing --style=changelog"
  • Or create your own format with the template engine:
    • hg outgoing --template '{date|shortdate} {author|person} {desc}\n' --newest-first

On Windows/cygwin

Using TortoiseHg in Cygwin

Depending on the cygwin version, using cygwins hg (and other tools) sometimes fails. TortoiseHg (http://bitbucket.org/tortoisehg/stable/wiki/Home) can be used as alternative.

To get rid of cygwin's hg rename /usr/bin/hg.

You can decide which ssl support you use in the cygwin shell. If you want to use the ssh-agent then you have to specify the following line in the [ui] section of ~/.hgrc: ssh = <Windows path to cygwin>\bin\ssh.exe -C

For the graphical interface of TortoiseHg Putty's pageant is the default ssh key provider. TortoiseHg allows easy graphical access to hg repositories within the Windows Explorer.

Accessing repository over ssh

  • If you want to use the ssh client of your Cygwin shell (and also ssh-agent), add the following to the [ui] section of your mercurial.ini: ssh = ssh -C
Personal tools