<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>ensandecer de um computólogo &#187; mercurial</title>
	<atom:link href="http://danielmartins.eti.br/blog/tag/mercurial/feed/" rel="self" type="application/rss+xml" />
	<link>http://danielmartins.eti.br/blog</link>
	<description>return 1;</description>
	<lastBuildDate>Sat, 08 May 2010 17:51:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>__hg_ps1 &#8211; Nome da branche na linha de comando do bash</title>
		<link>http://danielmartins.eti.br/blog/2009/11/04/__hg_ps1-nome-da-branche-na-linha-de-comando-do-bash/</link>
		<comments>http://danielmartins.eti.br/blog/2009/11/04/__hg_ps1-nome-da-branche-na-linha-de-comando-do-bash/#comments</comments>
		<pubDate>Wed, 04 Nov 2009 15:33:02 +0000</pubDate>
		<dc:creator>Daniel Elias</dc:creator>
				<category><![CDATA[Computação]]></category>
		<category><![CDATA[Comunidade]]></category>
		<category><![CDATA[Comunidades]]></category>
		<category><![CDATA[Dicas & How To]]></category>
		<category><![CDATA[mercurial]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[hg]]></category>
		<category><![CDATA[ps1]]></category>

		<guid isPermaLink="false">http://danielmartins.eti.br/blog/?p=541</guid>
		<description><![CDATA[Pra quem já usou git, sabe que existe o __git_ps1 que você pode usar para colocar na linha de comando do bash para lhe mostrar qual a branch atual de trabalho. Sem essa funcionalidade fica difícil trabalhar com as branches sem se perder de vez em quando. Procurando por algo similar no mercurial, achei o]]></description>
			<content:encoded><![CDATA[<p>Pra quem já usou git, sabe que existe o __git_ps1 que você pode usar para colocar na linha de comando do bash para lhe mostrar qual a branch atual de trabalho. Sem essa funcionalidade fica difícil trabalhar com as branches sem se perder de vez em quando. Procurando por algo similar no mercurial, achei o <a href="http://bitbucket.org/krbullock/hg_ps1/wiki/Home" target="_blank">__hg_ps1</a>.</p>
<p>Muito simples de instalar:</p>
<ol>
<li> <a href="http://bitbucket.org/krbullock/hg_ps1/get/tip.tar.gz" target="_blank">baixe o tarball</a></li>
<li>instale como qualquer aplicação python ( python setup.py install )</li>
<li>configure PS1 no <strong>~/.bashrc</strong></li>
</ol>
<blockquote><p>wget -c http://bitbucket.org/krbullock/hg_ps1/get/tip.tar.gz</p>
<p>tar xvf tip.tar.gz</p>
<p>cd hg_ps1/</p>
<p>sudo python setup.py install</p></blockquote>
<p>Coloque no ~/.bashrc o seguinte:</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">'${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;33m\] $(A=`__hg_ps1`  &amp;&amp; echo &quot;[$A]&quot; ) \[\033[0m\] \[\033[00m\]$  '</span></div></td></tr></tbody></table></div>
<p>Se você tiver também o git instalado, coloque este abaixo:</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #007800;">PS1</span>=<span style="color: #ff0000;">'${debian_chroot:+($debian_chroot)}\[\033[01;31m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[01;33m\]$(__git_ps1 &quot; [%s]&quot;) $(A=`__hg_ps1` &amp;&amp; echo &quot;[$A]&quot; ) \[\033[0m\] \[\033[00m\]$  '</span></div></td></tr></tbody></table></div>
<p>Como pode ser visto no comando acima, tem também o __git_ps1, se você entrar em algum repositório git, também funciona, a melhor configuração para manter os dois foi essa acima. Isso é muito útil. <img src='http://danielmartins.eti.br/blog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>


<!-- Begin TwitThis script (http://twitthis.com/) -->
<div style="text-align:left;">
<script type="text/javascript" src="http://s3.chuug.com/chuug.twitthis.scripts/twitthis.js"></script>
<script type="text/javascript">
<!--
document.write('<a href="javascript:;" onclick="TwitThis.pop();"><img src="http://s3.chuug.com/chuug.twitthis.resources/twitthis_grey_72x22.gif" alt="TwitThis" style="border:none;" /></a>');
//-->
</script>
</div>
<!-- /End -->

]]></content:encoded>
			<wfw:commentRss>http://danielmartins.eti.br/blog/2009/11/04/__hg_ps1-nome-da-branche-na-linha-de-comando-do-bash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Trabalhando com o Mercurial &#8211; HG</title>
		<link>http://danielmartins.eti.br/blog/2009/11/03/trabalhando-com-o-mercurial-hg/</link>
		<comments>http://danielmartins.eti.br/blog/2009/11/03/trabalhando-com-o-mercurial-hg/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 04:48:25 +0000</pubDate>
		<dc:creator>Daniel Elias</dc:creator>
				<category><![CDATA[Computação]]></category>
		<category><![CDATA[Comunidade]]></category>
		<category><![CDATA[Comunidades]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mercurial]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[hg]]></category>

		<guid isPermaLink="false">http://danielmartins.eti.br/blog/?p=482</guid>
		<description><![CDATA[Introdução Nos últimos tempos estou conscientizando os meus colegas de trabalho sobre os benefícios da utilização de um controle de código distribuído. Fiz uma análise nas vantagens e desvantagens do Git e HG (Mercurial) e escolhemos o Mercurial pois precisamos trabalhar em um ambiente heterogeneo e o suporte do Git ao windows  ainda é precário, até]]></description>
			<content:encoded><![CDATA[<h1>Introdução</h1>
<p>Nos últimos tempos estou conscientizando os meus colegas de trabalho sobre os benefícios da utilização de um controle de código distribuído. Fiz uma análise nas vantagens e desvantagens do Git e HG (Mercurial) e escolhemos o Mercurial pois precisamos trabalhar em um ambiente heterogeneo e o suporte do Git ao windows  ainda é precário, até achamos algumas iniciativas como o MSysGit, porém ainda possuem  um longo caminho pela frente para se tornar uma ferramenta que atenda as nossas necessidades(realidade). A comunidade do mercurial está mais evoluida neste sentido, e ao que estudamos o Mercurial disponibiliza todas as funcionalidades que almejamos em um gerenciador  de código distribuído.</p>
<p>O objetivo deste post é mostrar o fluxo de trabalho com mercurial, comentando os comandos executados em um fluxo de trabalho escolhido por mim. Alguns devem se perguntar, &#8220;Por que escolhido por você ?&#8221;, porque com o gerenciador de código distribuído não existe um fluxo de trabalho obrigatório a ser seguido, as ferramentas oferecem recursos para você adaptar fácilmente o fluxo de trabalho, portanto uma vez que você entende os conceitos do gerenciador de código distribuído você nota que é você quem faz seu fluxo de trabalho.</p>
<p>Não se assuste com as sequências de códigos, logo abaixo segue os comentários sobre as operações efetuadas, uma das coisas legais do mercurial é que a maioria dos comandos são legíveis, portanto tente entender somenter ao ler os comandos, senão entender, leia os comentários e avalie novamente os comandos, tudo deve fazer sentido, pelo menos eu espero que faça sentido. <img src='http://danielmartins.eti.br/blog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>Como dito anteriormente o objetivo não é explicar os conceitos. Portanto para entender os conceitos por trás do que é um gerenciador de código distribuído recomendo a leitura dos seguintes textos:</p>
<ul>
<li><span style="background-color: #ffffff;"><a href="http://www.pronus.eng.br/artigos_tutoriais/gerencia_configuracao/conceitos_basicos_controle_versao_centralizado_e_distribuido.php?pagNum=0" target="_blank">Conceitos básicos de controle de versão de softwew: Centralizado e Distribuído.</a></span></li>
<li><span style="background-color: #ffffff;"><a href="http://akitaonrails.com/2008/10/2/entendendo-git-e-instalando-gitorious-git-via-web" target="_blank">Entendendo git e instalando gitorious.</a> Nesse post recomendo os capítulos <strong>Mudança de paradigma</strong>, <strong>Problemas da centralização 1, 2 e 3</strong>, <strong>Git: Ferramenta para pessoas sem paciência</strong>, <strong>Mundo ideal .</strong></span></li>
<li><span style="background-color: #ffffff;"><a href="http://betterexplained.com/articles/intro-to-distributed-version-control-illustrated/" target="_blank">Introdução ao controle de versão distribuído (Ilustrado)</a>. (Inglês)</span></li>
</ul>
<h1>Configuração</h1>
<p>Para este post estou usando mercurial 1.3.1 instalado no ubuntu através do easy_install.</p>
<p>Recomendo configurar também o __hg_ps1, como <a href="http://danielmartins.eti.br/blog/2009/11/04/__hg_ps1-nome-da-branche-na-linha-de-comando-do-bash/" target="_blank">nesse post</a>.</p>
<p>Antes de começar configure seu <strong>.hgrc</strong>. Crie um arquivo no seu home:</p>
<blockquote><p>touch ~/.hgrc</p></blockquote>
<p>E então edite com seu editor favorito e coloque as seguinte informações sobre a aparência do hg:</p>
<blockquote><p>[ui]</p>
<p>username = Seu Nome &lt;seu@email.com.br&gt;</p>
<p>style = compact</p></blockquote>
<p>Antes de continuarmos, uma coisa que é muito legal no mercurial são as extensões. O mercurial já vem com uma série de extensões incluídas, para uma lista completa <a href="http://mercurial.selenic.com/wiki/UsingExtensions" target="_blank">clique aqui</a>, abaixo algumas que julgo essenciais, embora eu não vá explicar a utilização de todas nesse post, já deixe habilitado, não custa nada <img src='http://danielmartins.eti.br/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  com certeza explicarei nos posts seguintes.</p>
<ul>
<li>mercurialqueue</li>
<li>rebase</li>
<li>graphlog</li>
</ul>
<p>Para habilitar adicione ao arquivo <strong>~/.hgrc</strong> também uma nova seção para as extensões: <img src='http://danielmartins.eti.br/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<blockquote><p>[extensions]</p>
<p>hgext.graphlog =</p>
<p>hgext.mq =</p>
<p>hgext.rebase =</p></blockquote>
<h1>Comandos básicos</h1>
<p>Tendo em mente que você já sabe os conceitos, vamos fazer uma lista breve de comandos básicos que você deve saber na ponta do dedo.</p>
<blockquote><p><strong>hg clone &lt;url&gt;</strong></p></blockquote>
<p>faz uma cópia local do repositório informado</p>
<blockquote><p><strong>hg pull </strong></p></blockquote>
<p>faz download das mudanças no repositório de origem (pai)</p>
<blockquote><p><strong>hg push</strong></p></blockquote>
<p>faz upload das mudanças no repositório de origem (pai)</p>
<blockquote><p><strong>hg status</strong></p></blockquote>
<p>verifica se há alterações locais</p>
<blockquote><p><strong>hg tip</strong></p></blockquote>
<p>verifica qual a versão que está a frente no repositório, ou se preferir no topo(HEAD)</p>
<blockquote><p><strong>hg incoming</strong></p></blockquote>
<p>verifica o que tem de novo no repositório de origem, frequentemente usado antes de fazer um hg pull, para saber o que se esperar.</p>
<blockquote><p><strong>hg outgoing</strong></p></blockquote>
<p>verifica o que você tem de novo em relação ao repositório de origem, frequentemente usado antes de fazer hg push</p>
<blockquote><p><strong>hg merge</strong></p></blockquote>
<p>uni duas branches ou changeset transformando em uma.</p>
<h1>Trabalhando</h1>
<p>Vamos agora iniciar o trabalho, você vai codificar um projeto novo, então você cria uma pasta, inicia o repositório e adiciona inicialmente um arquivo de README com instruções ou informações sobre o projeto:</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">:~<span style="color: #000000; font-weight: bold;">/</span>src $  <span style="color: #c20cb9; font-weight: bold;">mkdir</span> projetonovo<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src $  <span style="color: #7a0874; font-weight: bold;">cd</span> projetonovo<span style="color: #000000; font-weight: bold;">/</span><br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  <span style="color: #c20cb9; font-weight: bold;">ls</span><br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  hg init<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;Este projeto vai dominar o mundo&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> README<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  hg add README<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  hg ci <span style="color: #660033;">-m</span> <span style="color: #ff0000;">&quot;Adicionado arquivo de README com informações sobre o projeto&quot;</span><br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  hg tip<br />
<span style="color: #000000;">0</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>tip<span style="color: #7a0874; font-weight: bold;">&#93;</span>   b65bb6ffc97c   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">14</span>:<span style="color: #000000;">55</span> -0400   root<br />
Adicionado arquivo de README com informações sobre o projeto</div></td></tr></tbody></table></div>
<p>Agora temos uma pasta com o nosso projeto e que está sendo versionado pelo mercurial, adicionamos um arquivo com informações para ser rastreado, fizemos o commit e depois verificamos qual o tip(head) do repositório. Você pode verificar que a saída do <strong>hg tip </strong>foi algo bem resumido, isso por que configuramos no <strong>~/.hgrc</strong> na seção <strong>[ui]</strong> , o estilo compacto <strong>style = compact</strong> . Se você deseja que o output dos comandos do mercurial sejam mais verbosos, basta comentar o style = compact ou remover do <strong>~/.hgrc</strong>.</p>
<p>Dentro de uma equipe de desenvolvimento de software, existem pelo menos 2 ciclos básicos que ficam em loop olhando pela perspectiva de implementação e não de análise, eu chamo de ciclo implementativo e corretivo.</p>
<p>Abaixo apresento minha solução para os ciclos em um mundo ideal. Há quem diga que não vivemos em um mundo ideal, mas eu acho importante para entender e fixar os conceitos. <img src='http://danielmartins.eti.br/blog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<h2>Ciclo implementativo</h2>
<ol>
<li>Identicar nova funcionalidade e traçar funcionamento básico</li>
<li>Abrir uma ramificação(branch) do projeto</li>
<li>Codificar e testar na branch criada <strong>SOMENTE</strong> para esta feature</li>
<li>Unir(merge) tip da branche da nova feature ao tip da mainline (branche default) e commitar</li>
<li>Fechar a ramificação da branche da nova feature</li>
</ol>
<p>Claro, aqui não é usado nenhuma formalidade nem nome bonito. É simplesmente como eu resumo minhas tarefas implementativas ao meu gosto. <img src='http://danielmartins.eti.br/blog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>Esse processo pode variar, o mercurial dá a liberdade de você fazer isso como quiser, abaixo eu demonstro como eu faço isso. Uma coisa interessante de ser mencionada é que as branchs são operações no repositório e portanto entram para o histórico do repositório, não esqueça que as branches precisam ser <strong>commitadas</strong>, dependendo do seu projeto você pode não querer saber como cada desenvolvedor criou a branch ou que nome deu para a branch, eu acho interessante e não vejo problema nisso, muito pelo contrário, temos um histórico fidedigno do desenvolvimento do projeto.</p>
<p>Então vou criar a branche para implementar a funcionalidade <strong>UltraMegaBoga</strong> de todos os tempos <img src='http://danielmartins.eti.br/blog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> .</p>
<div class="codecolorer-container text twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">:~/src/projetonovo $  hg branch NovaFeature_UltraMegaBoga<br />
marked working directory as branch NovaFeature_UltraMegaBoga<br />
:~/src/projetonovo $  hg ci -m &quot;Criado branch para implementar NovaFeature UltraMegaBoga&quot;<br />
:~/src/projetonovo $  hg branches<br />
NovaFeature_UltraMegaBoga      1:7fc70f299283<br />
default                        0:b65bb6ffc97c (inactive)</div></td></tr></tbody></table></div>
<p>Dae você pode ver que usamos o <strong>hg branch</strong> para nomear a branche padrão atual (<strong>default</strong>) e depois criamos de fato através do <strong>commit</strong> (<strong>ci</strong>), e depois confirmamos usando o<strong> hg branches</strong> para verificar quais as branches que temos no repositório. E agora sim podemos codificar a funcionalidade. No commit automaticamente somos movidos para a branch nova que acabamos de criar.</p>
<p>Então, implementando uma nova feature:</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $ &nbsp;<span style="color: #c20cb9; font-weight: bold;">touch</span> teste.py<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $ &nbsp;<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;print('Hellowww mercurial')&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> teste.py<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $ &nbsp;python teste.py<br />
Hellowww mercurial<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $ &nbsp;hg status<br />
? teste.py<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $ &nbsp;hg add teste.py<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $ &nbsp;hg status<br />
A teste.py<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $ &nbsp;hg ci <span style="color: #660033;">-m</span> <span style="color: #ff0000;">&quot;Criado arquivo da funcionalidade UltraMegaBoa&quot;</span><br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $ &nbsp;hg glog<br />
<span style="color: #000000; font-weight: bold;">@</span> &nbsp;<span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>tip<span style="color: #7a0874; font-weight: bold;">&#93;</span> &nbsp; c192d84f042a &nbsp; <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">16</span> <span style="color: #660033;">-0400</span> &nbsp; root<br />
<span style="color: #000000; font-weight: bold;">|</span> &nbsp; &nbsp;Criado arquivo da funcionalidade UltraMegaBoa<br />
<span style="color: #000000; font-weight: bold;">|</span><br />
o &nbsp;<span style="color: #000000;">1</span> &nbsp; 7fc70f299283 &nbsp; <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:01 <span style="color: #660033;">-0400</span> &nbsp; root<br />
<span style="color: #000000; font-weight: bold;">|</span> &nbsp; &nbsp;Criado branch para implementar NovaFeature UltraMegaBoga<br />
<span style="color: #000000; font-weight: bold;">|</span><br />
o &nbsp;<span style="color: #000000;">0</span> &nbsp; b65bb6ffc97c &nbsp; <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">14</span>:<span style="color: #000000;">55</span> <span style="color: #660033;">-0400</span> &nbsp; root<br />
Adicionado arquivo de README com informações sobre o projeto<br />
<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $ &nbsp;<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;import this&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> teste.py<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $ &nbsp;hg status<br />
M teste.py<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $ &nbsp;hg ci <span style="color: #660033;">-m</span> <span style="color: #ff0000;">&quot;Nova funcionalidade UltraMegaBoga implementada&quot;</span><br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $ &nbsp;hg glog<br />
<span style="color: #000000; font-weight: bold;">@</span> &nbsp;<span style="color: #000000;">3</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>tip<span style="color: #7a0874; font-weight: bold;">&#93;</span> &nbsp; f337dc212ea0 &nbsp; <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">19</span> <span style="color: #660033;">-0400</span> &nbsp; root<br />
<span style="color: #000000; font-weight: bold;">|</span> &nbsp; &nbsp;Nova funcionalidade UltraMegaBoga implementada<br />
<span style="color: #000000; font-weight: bold;">|</span><br />
o &nbsp;<span style="color: #000000;">2</span> &nbsp; c192d84f042a &nbsp; <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">16</span> <span style="color: #660033;">-0400</span> &nbsp; root<br />
<span style="color: #000000; font-weight: bold;">|</span> &nbsp; &nbsp;Criado arquivo da funcionalidade UltraMegaBoa<br />
<span style="color: #000000; font-weight: bold;">|</span><br />
o &nbsp;<span style="color: #000000;">1</span> &nbsp; 7fc70f299283 &nbsp; <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:01 <span style="color: #660033;">-0400</span> &nbsp; root<br />
<span style="color: #000000; font-weight: bold;">|</span> &nbsp; &nbsp;Criado branch para implementar NovaFeature UltraMegaBoga<br />
<span style="color: #000000; font-weight: bold;">|</span><br />
o &nbsp;<span style="color: #000000;">0</span> &nbsp; b65bb6ffc97c &nbsp; <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">14</span>:<span style="color: #000000;">55</span> <span style="color: #660033;">-0400</span> &nbsp; root<br />
Adicionado arquivo de README com informações sobre o projeto<br />
<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $ &nbsp;<span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;print('Testando funcionalidade ultramegaboga...')&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> teste.py<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $ &nbsp;hg status<br />
hg M teste.py<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $ &nbsp;hg ci <span style="color: #660033;">-m</span> <span style="color: #ff0000;">&quot;Implementado TesteUnitario e tudo funcionando como esperado&quot;</span><br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $ &nbsp;hg glog<br />
<span style="color: #000000; font-weight: bold;">@</span> &nbsp;<span style="color: #000000;">4</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>tip<span style="color: #7a0874; font-weight: bold;">&#93;</span> &nbsp; 63ddafc85f03 &nbsp; <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">21</span> <span style="color: #660033;">-0400</span> &nbsp; root<br />
<span style="color: #000000; font-weight: bold;">|</span> &nbsp; &nbsp;Implementado TesteUnitario e tudo funcionando como esperado<br />
<span style="color: #000000; font-weight: bold;">|</span><br />
o &nbsp;<span style="color: #000000;">3</span> &nbsp; f337dc212ea0 &nbsp; <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">19</span> <span style="color: #660033;">-0400</span> &nbsp; root<br />
<span style="color: #000000; font-weight: bold;">|</span> &nbsp; &nbsp;Nova funcionalidade UltraMegaBoga implementada<br />
<span style="color: #000000; font-weight: bold;">|</span><br />
o &nbsp;<span style="color: #000000;">2</span> &nbsp; c192d84f042a &nbsp; <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">16</span> <span style="color: #660033;">-0400</span> &nbsp; root<br />
<span style="color: #000000; font-weight: bold;">|</span> &nbsp; &nbsp;Criado arquivo da funcionalidade UltraMegaBoa<br />
<span style="color: #000000; font-weight: bold;">|</span><br />
o &nbsp;<span style="color: #000000;">1</span> &nbsp; 7fc70f299283 &nbsp; <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:01 <span style="color: #660033;">-0400</span> &nbsp; root<br />
<span style="color: #000000; font-weight: bold;">|</span> &nbsp; &nbsp;Criado branch para implementar NovaFeature UltraMegaBoga<br />
<span style="color: #000000; font-weight: bold;">|</span><br />
o &nbsp;<span style="color: #000000;">0</span> &nbsp; b65bb6ffc97c &nbsp; <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">14</span>:<span style="color: #000000;">55</span> <span style="color: #660033;">-0400</span> &nbsp; root<br />
Adicionado arquivo de README com informações sobre o projeto</div></td></tr></tbody></table></div>
<p>Opa!, muita informação?&#8230; nada, só algumas sendo repitidas. <img src='http://danielmartins.eti.br/blog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p><strong>Linhas 1 ~ 10</strong>: Nestas linhas apenas criamos um arquivo, colocamos conteúdo dentro dele, executamos, verificamos o status do repositório e eles nos diz que o arquivo novo não foi adicionado e então o adicionamos ao projeto para ser rastreado e então commitamos. Simples hein ?!</p>
<p><strong>Linhas 11</strong>: Na linha 11 há um comando novo que ainda não comentamos, o comando <strong>hg glog </strong>que mostra o log do repositório através de um grafo, o que facilita bastante a vida quando estamos trabalhando com branches(ramificações), para entender melhor veja bem que o <strong>glog</strong> traz a arvore de forma natural, ou seja,  da raiz até o topo ou nós. Na primeira coluna mostra os nós e aonde você está em relação aos nós da arvore, cada nó desse representa um <strong>commit</strong>, os nós são representados por <strong>o</strong> e onde você está através do <strong>@</strong>, na segunda coluna estão as revisões de números inteiros e sequencias que você pode usar para se direcionar ou situar na árvore ou histórico, o mercurial usa revisões sequencias e hashs para controlar o histórico e os changesets(conjuntos de mudanças).</p>
<p>E então esses procedimentos se repetem até o <strong>nó 4</strong> ou changeset <strong>63ddafc85f03</strong>, conforme pode ser visto localizando o @ no resultado do comando <strong>hg glog</strong>.</p>
<p>Vamos voltar para o branche default para fazer o merge e incorporar as modificações da branche UltraMegaBoga</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $ &nbsp;hg update default<br />
<span style="color: #000000;">0</span> files updated, <span style="color: #000000;">0</span> files merged, <span style="color: #000000;">1</span> files removed, <span style="color: #000000;">0</span> files unresolved<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $ &nbsp;hg glog<br />
o &nbsp;<span style="color: #000000;">4</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>tip<span style="color: #7a0874; font-weight: bold;">&#93;</span> &nbsp; 63ddafc85f03 &nbsp; <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">21</span> <span style="color: #660033;">-0400</span> &nbsp; root<br />
<span style="color: #000000; font-weight: bold;">|</span> &nbsp; &nbsp;Implementado TesteUnitario e tudo funcionando como esperado<br />
<span style="color: #000000; font-weight: bold;">|</span><br />
o &nbsp;<span style="color: #000000;">3</span> &nbsp; f337dc212ea0 &nbsp; <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">19</span> <span style="color: #660033;">-0400</span> &nbsp; root<br />
<span style="color: #000000; font-weight: bold;">|</span> &nbsp; &nbsp;Nova funcionalidade UltraMegaBoga implementada<br />
<span style="color: #000000; font-weight: bold;">|</span><br />
o &nbsp;<span style="color: #000000;">2</span> &nbsp; c192d84f042a &nbsp; <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">16</span> <span style="color: #660033;">-0400</span> &nbsp; root<br />
<span style="color: #000000; font-weight: bold;">|</span> &nbsp; &nbsp;Criado arquivo da funcionalidade UltraMegaBoa<br />
<span style="color: #000000; font-weight: bold;">|</span><br />
o &nbsp;<span style="color: #000000;">1</span> &nbsp; 7fc70f299283 &nbsp; <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:01 <span style="color: #660033;">-0400</span> &nbsp; root<br />
<span style="color: #000000; font-weight: bold;">|</span> &nbsp; &nbsp;Criado branch para implementar NovaFeature UltraMegaBoga<br />
<span style="color: #000000; font-weight: bold;">|</span><br />
<span style="color: #000000; font-weight: bold;">@</span> &nbsp;<span style="color: #000000;">0</span> &nbsp; b65bb6ffc97c &nbsp; <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">14</span>:<span style="color: #000000;">55</span> <span style="color: #660033;">-0400</span> &nbsp; root<br />
Adicionado arquivo de README com informações sobre o projeto</div></td></tr></tbody></table></div>
<p>Outro comando novo, <strong>hg update</strong>, com esse comando você pode alternar entre as branches(ramificações) do seu projeto e nas revisões também bastando passar o parâmetro <strong>hg update -r REV</strong>, na linha 1 alternei para a branch <strong>default</strong> e você pode perceber na saída do comando <strong>hg glog</strong> que o<strong> @</strong> voltou para <strong>revisão 0</strong> que é onde a revisão default parou, certo ? os outros commits foram da branche <strong>NovaFeature_UltraMegaBoga</strong>.</p>
<p>Agora vamos fazer o merge das duas branches.</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  hg merge NovaFeature_UltraMegaBoga<br />
<span style="color: #000000;">1</span> files updated, <span style="color: #000000;">0</span> files merged, <span style="color: #000000;">0</span> files removed, <span style="color: #000000;">0</span> files unresolved<br />
<span style="color: #7a0874; font-weight: bold;">&#40;</span>branch merge, dont forget to commit<span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  hg tip<br />
<span style="color: #000000;">4</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>tip<span style="color: #7a0874; font-weight: bold;">&#93;</span>   63ddafc85f03   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">21</span> -0400   root<br />
Implementado TesteUnitario e tudo funcionando como esperado<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  hg glog<br />
<span style="color: #000000; font-weight: bold;">@</span>  <span style="color: #000000;">4</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>tip<span style="color: #7a0874; font-weight: bold;">&#93;</span>   63ddafc85f03   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">21</span> -0400   root<br />
<span style="color: #000000; font-weight: bold;">|</span>    Implementado TesteUnitario e tudo funcionando como esperado<br />
<span style="color: #000000; font-weight: bold;">|</span><br />
o  <span style="color: #000000;">3</span>   f337dc212ea0   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">19</span> -0400   root<br />
<span style="color: #000000; font-weight: bold;">|</span>    Nova funcionalidade UltraMegaBoga implementada<br />
<span style="color: #000000; font-weight: bold;">|</span><br />
o  <span style="color: #000000;">2</span>   c192d84f042a   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">16</span> -0400   root<br />
<span style="color: #000000; font-weight: bold;">|</span>    Criado arquivo da funcionalidade UltraMegaBoa<br />
<span style="color: #000000; font-weight: bold;">|</span><br />
o  <span style="color: #000000;">1</span>   7fc70f299283   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:01 -0400   root<br />
<span style="color: #000000; font-weight: bold;">|</span>    Criado branch para implementar NovaFeature UltraMegaBoga<br />
<span style="color: #000000; font-weight: bold;">|</span><br />
<span style="color: #000000; font-weight: bold;">@</span>  <span style="color: #000000;">0</span>   b65bb6ffc97c   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">14</span>:<span style="color: #000000;">55</span> -0400   root<br />
Adicionado arquivo de README com informações sobre o projeto<br />
<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  hg ci <span style="color: #660033;">-m</span> <span style="color: #ff0000;">&quot;Incorporando branch NovaFeature_UltraMegaBoga a arvore principal de desenvolvimento&quot;</span><br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  hg glog<br />
<span style="color: #000000; font-weight: bold;">@</span>    <span style="color: #000000;">5</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>tip<span style="color: #7a0874; font-weight: bold;">&#93;</span>:<span style="color: #000000;">0</span>,<span style="color: #000000;">4</span>   b270c2750162   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">24</span> -0400   root<br />
<span style="color: #000000; font-weight: bold;">|</span>\     Incorporando branch NovaFeature_UltraMegaBoga a arvore principal de desenvolvimento<br />
<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">|</span><br />
<span style="color: #000000; font-weight: bold;">|</span> o  <span style="color: #000000;">4</span>   63ddafc85f03   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">21</span> -0400   root<br />
<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">|</span>    Implementado TesteUnitario e tudo funcionando como esperado<br />
<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">|</span><br />
<span style="color: #000000; font-weight: bold;">|</span> o  <span style="color: #000000;">3</span>   f337dc212ea0   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">19</span> -0400   root<br />
<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">|</span>    Nova funcionalidade UltraMegaBoga implementada<br />
<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">|</span><br />
<span style="color: #000000; font-weight: bold;">|</span> o  <span style="color: #000000;">2</span>   c192d84f042a   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">16</span> -0400   root<br />
<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">|</span>    Criado arquivo da funcionalidade UltraMegaBoa<br />
<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">|</span><br />
<span style="color: #000000; font-weight: bold;">|</span> o  <span style="color: #000000;">1</span>   7fc70f299283   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:01 -0400   root<br />
<span style="color: #000000; font-weight: bold;">|/</span>     Criado branch para implementar NovaFeature UltraMegaBoga<br />
<span style="color: #000000; font-weight: bold;">|</span><br />
o  <span style="color: #000000;">0</span>   b65bb6ffc97c   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">14</span>:<span style="color: #000000;">55</span> -0400   root<br />
Adicionado arquivo de README com informações sobre o projeto</div></td></tr></tbody></table></div>
<p><strong>hg merge &lt;nome_do_branch&gt;</strong> e então a união é feita, mas você pode ver pela saída do <strong>hg glog</strong> da linha 7 que o @ aparece tanto na revisão <strong>0</strong> quanto na <strong>4</strong>, porque faltou criar o nó que significa a união dos projetos e que será ponto de partida para novas alterações, e eles nos avisa ao fazer o merge <strong>não esqueça de fazer o commit.</strong> E então fizemos o commit informando que estamos incorporando a nova funcionalidade. e então você pode ver o resultado do glog novamente, gerou-se a revisão 5 e novo hash. Agora percebesse que o glog é realmente muito útil né ? <img src='http://danielmartins.eti.br/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Agora para finalizar o ciclo, precisamos fechar a branch que criamos para desenvolver a feature, essa é uma funcionalidade que veio no mercurial 1.2, pois antes disso o mercurial não permite deletar branch, imagine a quantidade de branches que perduravam a vida toda no repositório ?!.</p>
<p>Encerrando as atividades da branch UltraMegaBoga.</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  hg update NovaFeature_UltraMegaBoga<br />
<span style="color: #000000;">0</span> files updated, <span style="color: #000000;">0</span> files merged, <span style="color: #000000;">0</span> files removed, <span style="color: #000000;">0</span> files unresolved<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  hg ci <span style="color: #660033;">-m</span> <span style="color: #ff0000;">&quot;Fechando branch, feature implementada e incorporada a arvore principal&quot;</span> <span style="color: #660033;">--close-branch</span><br />
created new <span style="color: #c20cb9; font-weight: bold;">head</span><br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  hg branches<br />
default                        <span style="color: #000000;">5</span>:b270c2750162<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  hg glog<br />
<span style="color: #000000; font-weight: bold;">@</span>  <span style="color: #000000;">6</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>tip<span style="color: #7a0874; font-weight: bold;">&#93;</span>:<span style="color: #000000;">4</span>   7992ab50038d   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">26</span> -0400   root<br />
<span style="color: #000000; font-weight: bold;">|</span>    Fechando branch, feature implementada e incorporada a arvore principal<br />
<span style="color: #000000; font-weight: bold;">|</span><br />
<span style="color: #000000; font-weight: bold;">|</span> o  <span style="color: #000000;">5</span>:<span style="color: #000000;">0</span>,<span style="color: #000000;">4</span>   b270c2750162   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">24</span> -0400   root<br />
<span style="color: #000000; font-weight: bold;">|/|</span>    Incorporando branch NovaFeature_UltraMegaBoga a arvore principal de desenvolvimento<br />
<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">|</span><br />
o <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000;">4</span>   63ddafc85f03   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">21</span> -0400   root<br />
<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">|</span>    Implementado TesteUnitario e tudo funcionando como esperado<br />
<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">|</span><br />
o <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000;">3</span>   f337dc212ea0   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">19</span> -0400   root<br />
<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">|</span>    Nova funcionalidade UltraMegaBoga implementada<br />
<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">|</span><br />
o <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000;">2</span>   c192d84f042a   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">16</span> -0400   root<br />
<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">|</span>    Criado arquivo da funcionalidade UltraMegaBoa<br />
<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">|</span><br />
o <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000;">1</span>   7fc70f299283   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:01 -0400   root<br />
<span style="color: #000000; font-weight: bold;">|/</span>     Criado branch para implementar NovaFeature UltraMegaBoga<br />
<span style="color: #000000; font-weight: bold;">|</span><br />
o  <span style="color: #000000;">0</span>   b65bb6ffc97c   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">14</span>:<span style="color: #000000;">55</span> -0400   root<br />
Adicionado arquivo de README com informações sobre o projeto</div></td></tr></tbody></table></div>
<p>Basicamente na saída acima, voltamos para a branch da funcionalidade UltraMegaBoga e fazemos um commit de encerramento, com o parâmetro<strong> &#8211;close-branch</strong>. Com isso damos fim ao <strong>Ciclo Implementativo</strong>.</p>
<h2>Ciclo corretivo</h2>
<p>No ciclo corretivo, existem 2 aspectos:</p>
<ol>
<li>Você encontrou o problemas durante o desenvolvimento, antes de lançar uma versão.</li>
<li>Você encontrou ou encontraram pra você depois de ter lançado a versão.</li>
</ol>
<p>Para primeira ocasião você pode usar o mesmo mecanismo do ciclo implementativo para fazer as correções. Agora na segunda ocasião eu sugiro uma abordagem diferente, o ideal é corrigir o problema e gerar patches para serem incorporados uma vez que o software já foi congelado(lançado a versão) e está apenas sofrendo correções esporádicas e não mais vivendo em um intenso processo de produção, para isso eu uso a extensão do mercurial chamada <strong>MercurialQueues</strong>, que é um conjunto de comandos para gerenciamentos de uma fila de patchs no estilo LIFO(Last-In / First-Out), o ciclo corretivo se divide em:</p>
<ol>
<li>Identificar a causa do problema</li>
<li>Consertar o bug</li>
<li>Gerar patch e exportar</li>
</ol>
<p>Alguns devem ser perguntar o porque de eu sugerir <strong>MercurialQueues</strong>, pelo motivo de que os commits são maleáveis, no padrão os commits do mercurial são imutáveis, já com o MQ posso trabalhar em varios patches ao mesmo tempo somente manipulando a fila ao invés de ter que ficar importando e/ou exportando patches, posso também mesclar patches sem que isso interfira nos commits. IMHO, é mais conveniente. Você pode também usar o patch para aplicar a correção na versão que está em desenvolvimento</p>
<h3>Comandos básicos</h3>
<blockquote>
<h3><strong>hg qinit</strong></h3>
<h3><strong>hg qnew</strong></h3>
<p><strong>hg qrefresh</strong></p>
<p><strong>hg qpop</strong></p>
<p><strong>hg qpush</strong></p>
<p><strong>hg qfinish</strong></p>
<p><strong>hg qimport</strong></p></blockquote>
<p>Abaixo um exemplo de como criar uma fila e desenvolver um patch usando mercurial queues.</p>
<div class="codecolorer-container bash twitlight" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br />49<br />50<br />51<br />52<br />53<br />54<br />55<br />56<br />57<br />58<br />59<br />60<br />61<br />62<br />63<br />64<br />65<br />66<br />67<br />68<br />69<br />70<br />71<br />72<br />73<br />74<br />75<br />76<br />77<br />78<br />79<br />80<br />81<br />82<br />83<br />84<br />85<br />86<br />87<br />88<br />89<br />90<br />91<br />92<br />93<br />94<br />95<br />96<br />97<br />98<br />99<br />100<br />101<br />102<br />103<br />104<br />105<br /></div></td><td><div class="bash codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  hg qinit <span style="color: #660033;">-c</span><br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  hg qseries<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  hg qapplied<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  hg qnew fix_bug_01.patch<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;print('fixing bug')&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> mat.py<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  hg qseries<br />
fix_bug_01.patch<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  hg qapplied<br />
fix_bug_01.patch<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  hg glog<br />
<span style="color: #000000; font-weight: bold;">@</span>  <span style="color: #000000;">9</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>fix_bug_01.patch,qtip,tip,qbase<span style="color: #7a0874; font-weight: bold;">&#93;</span>   b3f8a3b6f155   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">22</span>:<span style="color: #000000;">55</span> -0400   root<br />
<span style="color: #000000; font-weight: bold;">|</span>    <span style="color: #7a0874; font-weight: bold;">&#91;</span>mq<span style="color: #7a0874; font-weight: bold;">&#93;</span>: fix_bug_01.patch<br />
<span style="color: #000000; font-weight: bold;">|</span><br />
o  <span style="color: #000000;">8</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>qparent<span style="color: #7a0874; font-weight: bold;">&#93;</span>   709a2b46c4cd   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">29</span> -0400   root<br />
<span style="color: #000000; font-weight: bold;">|</span>    Implementada feature nova e fechando branche<br />
<span style="color: #000000; font-weight: bold;">|</span><br />
o  <span style="color: #000000;">7</span>   cd5986a79612   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">28</span> -0400   root<br />
<span style="color: #000000; font-weight: bold;">|</span>    criando branche para feature nova<br />
<span style="color: #000000; font-weight: bold;">|</span><br />
o  <span style="color: #000000;">6</span>:<span style="color: #000000;">4</span>   7992ab50038d   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">26</span> -0400   root<br />
<span style="color: #000000; font-weight: bold;">|</span>    Fechando branch, feature implementada e incorporada a arvore principal<br />
<span style="color: #000000; font-weight: bold;">|</span><br />
<span style="color: #000000; font-weight: bold;">|</span> o  <span style="color: #000000;">5</span>:<span style="color: #000000;">0</span>,<span style="color: #000000;">4</span>   b270c2750162   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">24</span> -0400   root<br />
<span style="color: #000000; font-weight: bold;">|/|</span>    Incorporando branch NovaFeature_UltraMegaBoga a arvore principal de desenvolvimento<br />
<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">|</span><br />
o <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000;">4</span>   63ddafc85f03   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">21</span> -0400   root<br />
<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">|</span>    Implementado TesteUnitario e tudo funcionando como esperado<br />
<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">|</span><br />
o <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000;">3</span>   f337dc212ea0   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">19</span> -0400   root<br />
<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">|</span>    Nova funcionalidade UltraMegaBoga implementada<br />
<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">|</span><br />
o <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000;">2</span>   c192d84f042a   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">16</span> -0400   root<br />
<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">|</span>    Criado arquivo da funcionalidade UltraMegaBoa<br />
<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">|</span><br />
o <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000;">1</span>   7fc70f299283   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:01 -0400   root<br />
<span style="color: #000000; font-weight: bold;">|/</span>     Criado branch para implementar NovaFeature UltraMegaBoga<br />
<span style="color: #000000; font-weight: bold;">|</span><br />
o  <span style="color: #000000;">0</span>   b65bb6ffc97c   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">14</span>:<span style="color: #000000;">55</span> -0400   root<br />
Adicionado arquivo de README com informações sobre o projeto<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  hg qrefresh<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  <span style="color: #7a0874; font-weight: bold;">echo</span> <span style="color: #ff0000;">&quot;a = 1&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;&gt;</span> teste.py<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  hg <span style="color: #c20cb9; font-weight: bold;">diff</span><br />
<span style="color: #c20cb9; font-weight: bold;">diff</span> <span style="color: #660033;">-r</span> 2ae8338b6a9c teste.py<br />
<span style="color: #660033;">---</span> a<span style="color: #000000; font-weight: bold;">/</span>teste.py    Mon Nov 02 <span style="color: #000000;">23</span>:04:04 <span style="color: #000000;">2009</span> <span style="color: #660033;">-0400</span><br />
+++ b<span style="color: #000000; font-weight: bold;">/</span>teste.py    Mon Nov 02 <span style="color: #000000;">23</span>:07:04 <span style="color: #000000;">2009</span> <span style="color: #660033;">-0400</span><br />
<span style="color: #000000; font-weight: bold;">@@</span> -<span style="color: #000000;">1</span>,<span style="color: #000000;">3</span> +<span style="color: #000000;">1</span>,<span style="color: #000000;">4</span> <span style="color: #000000; font-weight: bold;">@@</span><br />
print<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">'Hellowww mercurial'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
import this<br />
print<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">'Testando funcionalidade ultramegaboga...'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
+a = <span style="color: #000000;">1</span><br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  hg qdiff<br />
<span style="color: #c20cb9; font-weight: bold;">diff</span> <span style="color: #660033;">-r</span> 709a2b46c4cd mat.py<br />
<span style="color: #660033;">---</span> a<span style="color: #000000; font-weight: bold;">/</span>mat.py    Mon Nov 02 <span style="color: #000000;">17</span>:<span style="color: #000000;">29</span>:<span style="color: #000000;">50</span> <span style="color: #000000;">2009</span> <span style="color: #660033;">-0400</span><br />
+++ b<span style="color: #000000; font-weight: bold;">/</span>mat.py    Mon Nov 02 <span style="color: #000000;">23</span>:07:07 <span style="color: #000000;">2009</span> <span style="color: #660033;">-0400</span><br />
<span style="color: #000000; font-weight: bold;">@@</span> -<span style="color: #000000;">1</span>,<span style="color: #000000;">1</span> +<span style="color: #000000;">1</span>,<span style="color: #000000;">2</span> <span style="color: #000000; font-weight: bold;">@@</span><br />
print<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #000000;">2</span>+<span style="color: #000000;">2</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
+print<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">'fixing bug'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
<span style="color: #c20cb9; font-weight: bold;">diff</span> <span style="color: #660033;">-r</span> 709a2b46c4cd teste.py<br />
<span style="color: #660033;">---</span> a<span style="color: #000000; font-weight: bold;">/</span>teste.py    Mon Nov 02 <span style="color: #000000;">17</span>:<span style="color: #000000;">29</span>:<span style="color: #000000;">50</span> <span style="color: #000000;">2009</span> <span style="color: #660033;">-0400</span><br />
+++ b<span style="color: #000000; font-weight: bold;">/</span>teste.py    Mon Nov 02 <span style="color: #000000;">23</span>:07:07 <span style="color: #000000;">2009</span> <span style="color: #660033;">-0400</span><br />
<span style="color: #000000; font-weight: bold;">@@</span> -<span style="color: #000000;">1</span>,<span style="color: #000000;">3</span> +<span style="color: #000000;">1</span>,<span style="color: #000000;">4</span> <span style="color: #000000; font-weight: bold;">@@</span><br />
print<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">'Hellowww mercurial'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
import this<br />
print<span style="color: #7a0874; font-weight: bold;">&#40;</span><span style="color: #ff0000;">'Testando funcionalidade ultramegaboga...'</span><span style="color: #7a0874; font-weight: bold;">&#41;</span><br />
+a = <span style="color: #000000;">1</span><br />
<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  hg qapplied<br />
fix_bug_01.patch<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  hg qpop<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  hg qseries<br />
fix_bug_01.patch<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  hg qapplied<br />
<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  hg qcommit<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  hg tip<br />
<span style="color: #000000;">8</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>tip<span style="color: #7a0874; font-weight: bold;">&#93;</span>   709a2b46c4cd   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">29</span> -0400   root<br />
Implementada feature nova e fechando branche<br />
<br />
:~<span style="color: #000000; font-weight: bold;">/</span>src<span style="color: #000000; font-weight: bold;">/</span>projetonovo $  hg glog<br />
<span style="color: #000000; font-weight: bold;">@</span>  <span style="color: #000000;">8</span><span style="color: #7a0874; font-weight: bold;">&#91;</span>tip<span style="color: #7a0874; font-weight: bold;">&#93;</span>   709a2b46c4cd   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">29</span> -0400   root<br />
<span style="color: #000000; font-weight: bold;">|</span>    Implementada feature nova e fechando branche<br />
<span style="color: #000000; font-weight: bold;">|</span><br />
o  <span style="color: #000000;">7</span>   cd5986a79612   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">28</span> -0400   root<br />
<span style="color: #000000; font-weight: bold;">|</span>    criando branche para feature nova<br />
<span style="color: #000000; font-weight: bold;">|</span><br />
o  <span style="color: #000000;">6</span>:<span style="color: #000000;">4</span>   7992ab50038d   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">26</span> -0400   root<br />
<span style="color: #000000; font-weight: bold;">|</span>    Fechando branch, feature implementada e incorporada a arvore principal<br />
<span style="color: #000000; font-weight: bold;">|</span><br />
<span style="color: #000000; font-weight: bold;">|</span> o  <span style="color: #000000;">5</span>:<span style="color: #000000;">0</span>,<span style="color: #000000;">4</span>   b270c2750162   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">24</span> -0400   root<br />
<span style="color: #000000; font-weight: bold;">|/|</span>    Incorporando branch NovaFeature_UltraMegaBoga a arvore principal de desenvolvimento<br />
<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">|</span><br />
o <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000;">4</span>   63ddafc85f03   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">21</span> -0400   root<br />
<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">|</span>    Implementado TesteUnitario e tudo funcionando como esperado<br />
<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">|</span><br />
o <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000;">3</span>   f337dc212ea0   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">19</span> -0400   root<br />
<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">|</span>    Nova funcionalidade UltraMegaBoga implementada<br />
<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">|</span><br />
o <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000;">2</span>   c192d84f042a   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:<span style="color: #000000;">16</span> -0400   root<br />
<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">|</span>    Criado arquivo da funcionalidade UltraMegaBoa<br />
<span style="color: #000000; font-weight: bold;">|</span> <span style="color: #000000; font-weight: bold;">|</span><br />
o <span style="color: #000000; font-weight: bold;">|</span>  <span style="color: #000000;">1</span>   7fc70f299283   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">17</span>:01 -0400   root<br />
<span style="color: #000000; font-weight: bold;">|/</span>     Criado branch para implementar NovaFeature UltraMegaBoga<br />
<span style="color: #000000; font-weight: bold;">|</span><br />
o  <span style="color: #000000;">0</span>   b65bb6ffc97c   <span style="color: #000000;">2009</span>-<span style="color: #000000;">11</span>-02 <span style="color: #000000;">14</span>:<span style="color: #000000;">55</span> -0400   root<br />
Adicionado arquivo de README com informações sobre o projeto</div></td></tr></tbody></table></div>
<p><strong>Linhas 1 ~ 10</strong>: É iniciada uma fila através do comando <strong>hg qinit -c</strong> , -c significa que a fila será versionada e portanto poderá ser usado o comando <strong>hg qcommit</strong>. Depois verificamos se está tudo zerado usando os comandos <strong>hg qseries</strong> e <strong>hg qapplied</strong> , o <strong>qseries</strong> nos permite verificar quais patchs estão na fila e o <strong>qapplied</strong> quais patchs estão aplicados efetivamente no repositório. Para criar um novo patch basta executar o <strong>hg qnew &lt;nome_do_patch&gt;</strong> que no exemplo acima atribui o nome fix_bug_01.patch. Alteramos o arquivo e podemos ver com o <strong>glog</strong> que ao criar o patch, já é aplicado automaticamente no repositório e por padrão coloca como msg do commit <strong>[mq]</strong>:  nome_do_patch.</p>
<p><strong>Linhas 40 ~ 51</strong>: É incluídas as alterações feitas no patch atual através do comando <strong>hg qrefresh</strong>. É feita uma alteração no arquivo teste.py  e pra ver a diferença entre <strong>hg diff</strong> e <strong>hg qdiff</strong> é executado hg diff que é a última alteração que o repostório reconhece, quando executamos o <strong>hg qrefresh</strong> ele pega as alterações e armazena internamente no patch e as alterações não ficam mais no repositório comum e sim no patch que está sendo desenvolvido com mercurial queue. O <strong>hg qdiff</strong> mostra todas as alterações incluídas(através do <strong>qrefresh</strong>) no patch.</p>
<p><strong>Linhas 67 ~ 75</strong>: É verificado que o patch continua aplicado (através do <strong>qapplied</strong>) e já que o patch está completo está na hora de armazena-lo e retirá-lo da lista de aplicados através do comando <strong>hg qpop</strong> que remove do topo da fila o patch e como o único e no topo é o <strong>fix_bug_01.patch</strong> não retorna nada o comando <strong>hg qapplied</strong> e então o patch é commitado através do <strong>hg qcommit</strong> essa fila de patchs é um outro repositório interno do mercurial, se você quiser confirmar é só entrar no .<strong>hg/patches</strong> do se repositório e rodar o comando <strong>hg glog</strong> para constatar o sub-repositório de patches criado pelo <strong>MercurialQueue</strong>.</p>
<p>Para exportar o patch pode usar o comando <strong>hg export &lt;nome_do_patch&gt;</strong> e para importar para o repositório normal use <strong>hg import </strong>ou se quiser importar para uma outra lista de patches <strong>hg qimport</strong> e então o patch será adicionado ao <strong>hg qseries</strong>.</p>
<p>Enfim as possibilidades são enormes com o MercurialQueue, e isso foi só uma demonstração básica do uso de MercurialQueues.</p>
<p><em>Ufa! Espero que alguém tenha paciência pra ler. Essa tá longe de ser a versão final desse post. Publiquei logo para ter um norte. Portanto agradeceria bastante as sugestões de melhoria, críticas, correções e etc. </em></p>
<h3>Próximos posts(Aguardem) <img src='http://danielmartins.eti.br/blog/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> :</h3>
<ul>
<li>Trabalhando com o Mercurial &#8211; Mais sobre MercurialQueues</li>
<li>Trabalhando com o Mercurial &#8211; Rebaseando</li>
<li>Trabalhando com o Mercurial &#8211; Resolvendo Conflitos</li>
</ul>
<div id="_mcePaste" style="overflow: hidden; position: absolute; left: -10000px; top: 1121px; width: 1px; height: 1px;"> <img src='http://danielmartins.eti.br/blog/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </div>


<!-- Begin TwitThis script (http://twitthis.com/) -->
<div style="text-align:left;">
<script type="text/javascript" src="http://s3.chuug.com/chuug.twitthis.scripts/twitthis.js"></script>
<script type="text/javascript">
<!--
document.write('<a href="javascript:;" onclick="TwitThis.pop();"><img src="http://s3.chuug.com/chuug.twitthis.resources/twitthis_grey_72x22.gif" alt="TwitThis" style="border:none;" /></a>');
//-->
</script>
</div>
<!-- /End -->

]]></content:encoded>
			<wfw:commentRss>http://danielmartins.eti.br/blog/2009/11/03/trabalhando-com-o-mercurial-hg/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
