Author: the.mente Date: Tue Apr 8 13:02:57 2008 New Revision: 88 Modified: trunk/book/ch04-branching-and-merging.xml
Log: Capitulo 4 seção 2 titulo Copiando modificações específicas issue 36 Modified: trunk/book/ch04-branching-and-merging.xml ============================================================================== --- trunk/book/ch04-branching-and-merging.xml (original) +++ trunk/book/ch04-branching-and-merging.xml Tue Apr 8 13:02:57 2008 @@ -73,7 +73,7 @@ <!-- ================================================================= --> <!-- ================================================================= --> <sect1 id="svn.branchmerge.using"> - <title>Using Branches</title> + <title>Usando Ramos</title> <para>Até aqui, você ja deve saber como cada commit cria uma nova árvore de arquivos (chamada de <quote>revisão</quote>) no @@ -442,7 +442,7 @@ <!-- =============================================================== --> <sect2 id="svn.branchmerge.using.concepts"> - <title>The Key Concepts Behind Branches</title> + <title>O conceito chame por trás de ramos</title> <para>Há duas lições importantes que você deve se lembrar desta seção. Primeiro, o Subversion não tem um conceito interno de @@ -467,7 +467,7 @@ <!-- ================================================================= --> <!-- ================================================================= --> <sect1 id="svn.branchmerge.copychanges"> - <title>Copying Changes Between Branches</title> + <title>Copiando modificações entre ramos</title> <para>Agora você e Sally estão trabalhando em ramos paralelos do projeto: você está trabalhando no seu próprio ramo, e @@ -500,29 +500,30 @@ <!-- =============================================================== --> <sect2 id="svn.branchmerge.copychanges.specific"> - <title>Copying Specific Changes</title> + <title>Copiando modificações específicas</title> - <para>In the previous section, we mentioned that both you and - Sally made changes to <filename>integer.c</filename> on - different branches. If you look at Sally's log message for - revision 344, you can see that she fixed some spelling errors. - No doubt, your copy of the same file still has the same spelling - errors. It's likely that your future changes to this file will - be affecting the same areas that have the spelling errors, so - you're in for some potential conflicts when you merge your - branch someday. It's better, then, to receive Sally's change - now, <emphasis>before</emphasis> you start working too heavily - in the same places.</para> - - <para>It's time to use the <command>svn merge</command> command. - This command, it turns out, is a very close cousin to the - <command>svn diff</command> command (which you read about in - <xref linkend="svn.tour"/>). Both commands are able to - compare any two objects in the repository and describe the - differences. For example, you can ask <command>svn - diff</command> to show you the exact change made by Sally in - revision 344:</para> + <para>Na seção anterior, nos comentamos que tanto você quanto + Sally fizeram alterações em <filename>integer.c</filename> + em ramos distintos.Se você olhar a mensagem de log de Sally + na revisão 344, você verá que ela corrigiu alguns erros de + escrita. Sem duvida alguma, a sua cópia deste arquivo tem os + mesmo erros de escrita. É provavel que suas futuras + modificações a este arquivo vão afetar as mesmas áreas onde + foram feitas as correções de escrita, então você tem grandes + chances de ter varios conflitos quando for fundir o seu ramo, + eventualmente. Portanto, é melhor receber as modificações de + Sally agora, <emphasis>antes</emphasis> de você começar a + trabalhar de forma massiva nessas áreas.</para> + + <para>É hora de usar o comando <command>svn merge</command>. + Esse comando é um primo muito próximo do comando + <command>svn diff</command> (que você viu em + <xref linkend="svn.tour"/>). Os dois comando comparam dois + objetos no repositório e mostram as diferenças. Por exemplo, + você pode pedir com o comando <command>svn diff</command> + para ver com exatidão as mudanças feitas por Sally na + revisão 344:</para> <screen> $ svn diff -c 344 http://svn.example.com/repos/calc/trunk @@ -569,10 +570,10 @@ printf("error: fseek() returned non-zero\n"); </screen> - <para>The <command>svn merge</command> command is almost exactly - the same. Instead of printing the differences to your - terminal, however, it applies them directly to your working - copy as <emphasis>local modifications</emphasis>:</para> + <para>O comando <command>svn merge</command> é quase que o + mesmo. Ao invés de imprimir as diferenças no terminal, + ele as aplica diretamente à cópia de trabalho classificando + como <emphasis>local modifications</emphasis>:</para> <screen> $ svn merge -c 344 http://svn.example.com/repos/calc/trunk @@ -582,32 +583,36 @@ M integer.c </screen> - <para>The output of <command>svn merge</command> shows that your - copy of <filename>integer.c</filename> was patched. It now - contains Sally's change—the change has been - <quote>copied</quote> from the trunk to your working copy of - your private branch, and now exists as a local modification. - At this point, it's up to you to review the local modification - and make sure it works correctly.</para> - - <para>In another scenario, it's possible that things may not have - gone so well, and that <filename>integer.c</filename> may have - entered a conflicted state. You might need to resolve the - conflict using standard procedures (see <xref - linkend="svn.tour"/>), or if you decide that the merge was a - bad idea altogether, simply give up and <command>svn - revert</command> the local change.</para> - - <para>But assuming that you've reviewed the merged change, you can - <command>svn commit</command> the change as usual. At that - point, the change has been merged into your repository branch. - In version control terminology, this act of copying changes - between branches is commonly called - <firstterm>porting</firstterm> changes.</para> - - <para>When you commit the local modification, make sure your log - message mentions that you're porting a specific change from - one branch to another. For example:</para> + <para>A saida do comando <command>svn merge</command> mostra + a sua cópia de <filename>integer.c</filename> sofreu uma + correção. Agora ele contém as modificações feitas por + Sally— essas modificações foram <quote>copiadas</quote> + do tronco do repositório para a cópia de trabalho do seu ramo + privado, e agora existe como uma modificação local. A esta + altura, depende de você revisar essa modificação local e ter + certeza de funciona.</para> + + <para>Em outra simulação, é possivel que as coisas não tenham + ocorrido tão bem assim, e o arquivo + <filename>integer.c</filename> tenha entrado em estado de + conflito. Pode ser que você precise resolver o conflito usando + procedimentos padrão (see <xref linkend="svn.tour"/>), ou se + você decidir que fazer a fusão dos arquivos tenha sido uma má + idéia, desista e rode o comando <command>svn revert</command> + para retirar as modificações locais.</para> + + <para>Partindo do pré-suposto que você revisou as modificações + do processo de fusão , então você pode fazer o <command>svn + commit</command> como de costume. A este ponto, a mudança foi + fusionada ao seu ramo no repositório. Em tecnologias de + controle de versão, esse ato de copiar mudanças entre ramos + recebe o nome de <firstterm>portar</firstterm> + mudanças.</para> + + <para>Quando você fizer o commit das modificações locais, não + esqueça de colocar na mensagem de log que você está portando + uma modificação especifica de um ramo para outro.Por + exemplo:</para> <screen> $ svn commit -m "integer.c: ported r344 (spelling fixes) from trunk." @@ -616,17 +621,17 @@ Committed revision 360. </screen> - <para>As you'll see in the next sections, this is a very - important <quote>best practice</quote> to follow.</para> + <para>Como você verá nas próximas seções, essa é uma <quote>boa + pratica</quote> importantíssima a ser seguida.</para> <sidebar> - <title>Why Not Use Patches Instead?</title> + <title>Porque não usar Patches?</title> - <para>A question may be on your mind, especially if you're a - Unix user: why bother to use <command>svn merge</command> at - all? Why not simply use the operating system's - <command>patch</command> command to accomplish the same job? - For example:</para> + <para>Essa questão pode estar em sua mente, especialmente se + você for um usuário de Unix: porque usar o comando + <command>svn merge</command>? Porque não simplismente usar + o comando do sistema <command>patch</command> para realizar + esta tarefa? Por exemplo:</para> <screen> $ svn diff -c 344 http://svn.example.com/repos/calc/trunk > patchfile @@ -639,59 +644,61 @@ done </screen> - <para>In this particular case, yes, there really is no - difference. But <command>svn merge</command> has special - abilities that surpass the <command>patch</command> program. - The file format used by <command>patch</command> is quite - limited; it's only able to tweak file contents. There's no - way to represent changes to <emphasis>trees</emphasis>, such - as the addition, removal, or renaming of files and - directories. Nor can the <command>patch</command> program - notice changes to properties. If Sally's change had, - say, added a new directory, the output of <command>svn - diff</command> wouldn't have mentioned it at - all. <command>svn diff</command> only outputs the limited - patch-format, so there are some ideas it simply can't - express. The <command>svn merge</command> command, however, - can express changes in tree structure and properties by - directly applying them to your working copy.</para> + <para>Neste caso em particular, sim, realmente não há + diferença. Mas o comando <command>svn merge</command> tem + habilidades especiais que superam o comando <command> + patch</command>. O formato do arquivo usado pelo <command> + patch</command> é bem limitado; é apenas capaz de mexer o + conteúdo dos arquivos. Não há forma de representar mudanças + em <emphasis>arvores</emphasis>, como o criar, remover e + renomear arquivos e diretórios. Tão pouco pode o comando + <command>patch</command> ver mudanças de propriedades. Se + nas modificações de Sally, um diretório tivesse sido criado, + a saida do comando <command>svn diff</command> não iria + fazer menção disso. <command>svn diff</command> somente + mostra forma limitada do patch, então existem coisa que ele + simplismente não irá mostrar. O comando <command>svn + merge</command>, por sua vez, pode mostrar modificações + em estrutura de árvores e propriedades aplicando estes + diretamente em sua cópia de trabalho.</para> </sidebar> - <para>A word of warning: while <command>svn diff</command> and - <command>svn merge</command> are very similar in concept, they - do have different syntax in many cases. Be sure to read about - them in <xref linkend="svn.ref"/> for details, or ask - <command>svn help</command>. For example, <command>svn - merge</command> requires a working-copy path as a target, i.e. - a place where it should apply the tree-changes. If the target - isn't specified, it assumes you are trying to perform one of - the following common operations:</para> + <para>Um aviso: enquanto o comando <command>svn diff</command> + e o <command>svn merge</command> tem conceitos similare, eles + apresentam sintaxe diferente em vários casos. Leia sobre isso + em <xref linkend="svn.ref"/> para mais detalhes, ou peça ajuda + ao comando <command>svn help</command>. Por exemplo, o comando + <command>svn merge</command> precisa de uma cópia de trabalho + com destino, isto é, um local onde aplicar as modificações. Se + um destino não for especificado, ele assume que você está + tentando uma dessas operações:</para> <orderedlist> <listitem> - <para>You want to merge directory changes into your current - working directory.</para> + <para>Você quer fundir modificações de diretorio no seu + diretório de trabalho atual.</para> </listitem> <listitem> - <para>You want to merge the changes in a specific file into - a file by the same name which exists in your current working - directory.</para> + <para>Você quer fundir as modificações de um arquivo em + específico, em outro arquivo de mesmo nome que existe no seu + diretorio atual de trabalho.</para> </listitem> </orderedlist> - <para>If you are merging a directory and haven't specified a - target path, <command>svn merge</command> assumes the first case - above and tries to apply the changes into your current - directory. If you are merging a file, and that file (or a file - by the same name) exists in your current working directory, - <command>svn merge</command> assumes the second case and tries - to apply the changes to a local file with the same name.</para> - - <para>If you want changes applied somewhere else, you'll - need to say so. For example, if you're sitting in the parent - directory of your working copy, you'll have to specify the - target directory to receive the changes:</para> + <para>Se você esta fundindo um diretório e não especificou um + destino, <command>svn merge</command> assume o primeiro caso + acima e tenta aplicar as modificações no seu diretório atual. Se + você está fundindo um arquivo, e este arquivo (ou arquivo de + mesmo nome) existe no diretório atual, o <command>svn + merge</command> assume o segundo caso, e tenta aplicar as + modificações no arquivo local de mesmo nome.</para> + + <para>Se você quer que as modificações seja aplicadas em outro + local, você vai precisar avisar. Por exemplo, se você está no + diretório pai de sua cópia de trabalho, você vai precisar + especificar o diretório de destino a receber as + modificações:</para> <screen> $ svn merge -c 344 http://svn.example.com/repos/calc/trunk my-calc-branch _______________________________________________ svn-pt_br mailing list svn-pt_br@red-bean.com http://www.red-bean.com/mailman/listinfo/svn-pt_br