versionControl/vcs.tex
changeset 84 535151a16560
parent 83 c52c9a615356
child 91 6f2f2f949e32
equal deleted inserted replaced
83:c52c9a615356 84:535151a16560
   617   \end{columns}
   617   \end{columns}
   618 \end{frame}
   618 \end{frame}
   619 
   619 
   620 \begin{frame}[fragile]
   620 \begin{frame}[fragile]
   621   \frametitle{Merging}
   621   \frametitle{Merging}
       
   622   \emphbar{Lets sync both these branches!}
   622   \begin{lstlisting}
   623   \begin{lstlisting}
   623 $ hg pull ../Fevicol-pull
   624 $ hg pull ../Fevicol-pull
   624 pulling from ../Fevicol-pull
   625 pulling from ../Fevicol-pull
   625 searching for changes
   626 searching for changes
   626 adding changesets
   627 adding changesets
   627 adding manifests
   628 adding manifests
   628 adding file changes
   629 adding file changes
   629 added 1 changesets with 1 changes to 1 files (+1 heads)
   630 added 1 changesets with 1 changes to 1 files (+1 heads)
   630 (run 'hg heads' to see heads, 'hg merge' to merge)    
   631 (run 'hg heads' to see heads, 'hg merge' to merge)    
   631   \end{lstlisting} %$
   632   \end{lstlisting} %$
   632   Output is already suggesting something!
   633   \begin{itemize}
       
   634   \item \typ{pull} can be done from a branch explicitly also.
       
   635   \item Output is already suggesting something!
       
   636   \end{itemize}  
   633 \end{frame}
   637 \end{frame}
   634 
   638 
   635 %% Here one can mention the point of having push and pull separate. Because of this policy, changes made are not lost.
   639 %% Here one can mention the point of having push and pull separate. Because of this policy, changes made are not lost.
   636 \begin{frame}[fragile]
   640 \begin{frame}[fragile]
   637   \frametitle{Analyzing events in detail}
   641   \frametitle{Analyzing events in detail}
   638   Since hg \typ{pull} don't update the files directly, our changes are still safe. Following command can help us deal this merging problem in better way:
   642   Since hg \typ{pull} don't update the files directly, our changes are still safe. \typ{hg} provides some commands to help understand such problems.
       
   643 \begin{tiny}
   639   \begin{lstlisting}
   644   \begin{lstlisting}
   640 $ hg heads
   645 $ hg heads
   641   \end{lstlisting}
   646 changeset:   4:c5f40fda69cf
   642   This commands shows repo/branch heads.
   647 tag:         tip
   643   \begin{lstlisting}
   648 parent:      2:0b8286c48e88
       
   649 user:        Shantanu <shantanuc@fosse.in>
       
   650 date:        Fri Jan 22 19:43:46 2010 +0530
       
   651 summary:     Updated tagline for feviCol.py.
       
   652 
       
   653 changeset:   3:60edf0e499e7
       
   654 user:        Shantanu <shantanuc@fosse.in>
       
   655 date:        Fri Jan 22 19:47:58 2010 +0530
       
   656 summary:     Added firstAdd.py.
       
   657   \end{lstlisting} %%$
       
   658 \end{tiny}
       
   659   It shows current repository heads or show branch head
       
   660 \end{frame}
       
   661 
       
   662 \begin{frame}[fragile]
       
   663   \frametitle{What went wrong: Analysis}
       
   664     \begin{lstlisting}
   644 $ hg glog    
   665 $ hg glog    
   645   \end{lstlisting}
   666   \end{lstlisting} %%$
   646   It shows revision history alongside an ASCII revision graph.\\
   667   \begin{center}
   647   Because of different track, \typ{up} command fails.
   668   \includegraphics[height=2in]{glog}  
       
   669   \end{center}  
       
   670   It shows history alongside an ASCII revision graph.  
       
   671 \end{frame}
       
   672 
       
   673 \begin{frame}[fragile]
       
   674   \frametitle{What went wrong: Analysis cont...}
       
   675   Because of different 'pasts', \typ{up} command fails.
   648   \begin{lstlisting}
   676   \begin{lstlisting}
   649 $ hg up
   677 $ hg up
   650 abort: crosses branches (use 'hg merge' or 'hg update -C')
   678 abort: crosses branches (use 'hg merge' or 'hg update -C')
   651   \end{lstlisting} %$
   679   \end{lstlisting} %$
   652 \end{frame}
   680 \end{frame}
   653 
   681 
   654 \begin{frame}[fragile]
   682 \begin{frame}[fragile]
   655   \frametitle{Merging}
   683   \frametitle{Merging}
   656   \typ{hg merge} command merge working directory with another revision.
   684   To deal such situations \typ{hg merge} command merge working directory with another revision.
   657   \begin{lstlisting}
   685   \begin{lstlisting}
   658 $ hg merge    
   686 $ hg merge
       
   687  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
       
   688 (branch merge, don't forget to commit)   
   659   \end{lstlisting} %$
   689   \end{lstlisting} %$
   660   After merging two branches, we have to commit the results to create a common head.
   690   After merging two branches, we have to commit the results to create a common head.
   661   \begin{lstlisting}
   691   \begin{lstlisting}
   662 $ hg ci -u "Shantanu <shantanu@fossee.in>" 
   692 $ hg ci -u "Shantanu <shantanu@fossee.in>" 
   663         -m "Merged branches."
   693         -m "Merged branches."
   664 $ hg heads    
       
   665 $ hg glog
       
   666   \end{lstlisting} %$
   694   \end{lstlisting} %$
   667   \inctime{15}
   695   \inctime{15}
       
   696 \end{frame}
       
   697 
       
   698 \begin{frame}[fragile]
       
   699   \frametitle{\typ{glog}}
       
   700   \begin{center}
       
   701   \includegraphics[height=2.8in]{glog-2}  
       
   702   \end{center}
       
   703 \end{frame}
       
   704 
       
   705 \begin{frame}[fragile]
       
   706   \frametitle{More information}
       
   707   \begin{itemize}
       
   708   \item \typ{merge} fails if there are conflicting changes.
       
   709     \begin{itemize}
       
   710     \item Like two persons editing same file, same line and pushing it upstream.
       
   711     \end{itemize}
       
   712   \item In conflicts, one have to perform \typ{merge} manually.
       
   713   \item \typ{hg} provides \typ{incoming} command, which checks the would-be imported changes
       
   714     \begin{itemize}
       
   715     \item To avoid conflicting changes before importing.
       
   716     \end{itemize}
       
   717   \end{itemize}
   668 \end{frame}
   718 \end{frame}
   669 
   719 
   670 % Steps to follow to make life easier. How to avoid/handle manual merges.
   720 % Steps to follow to make life easier. How to avoid/handle manual merges.
   671 \section{Work flow: DOS and DON'Ts}
   721 \section{Work flow: DOS and DON'Ts}
   672 
   722 
   673 \begin{frame}
   723 \begin{frame}
   674   \frametitle{Motto behind hg}
   724   \frametitle{Motto behind hg}
   675   \begin{center}
   725   \begin{center}
   676   \color{red}{``Commit Early Commit Often.''}\\  
   726   \color{red}{``Commit Early Commit Often.''}
   677   \end{center}  
   727   \end{center}  
   678 \end{frame}
   728 \end{frame}
   679 
   729 
   680 \begin{frame}
   730 \begin{frame}
   681   \frametitle{Cheat Sheet}
   731   \frametitle{Cheat Sheet}
   691   \item Commit.
   741   \item Commit.
   692   \item Pull changesets.
   742   \item Pull changesets.
   693   \item Merge(if required).
   743   \item Merge(if required).
   694   \item Push.
   744   \item Push.
   695   \end{itemize}
   745   \end{itemize}
   696   \inctime{10}
   746   \inctime{20}
   697 \end{frame}
   747 \end{frame}
   698 
   748 
   699 \begin{frame}
   749 \begin{frame}
   700   \frametitle{Suggested Readings:}
   750   \frametitle{Suggested Readings:}
   701   \begin{itemize}
   751   \begin{itemize}
   703   \item \url{http://hgbook.red-bean.com/}    
   753   \item \url{http://hgbook.red-bean.com/}    
   704   \item \url{http://karlagius.com/2009/01/09/version-control-for-the-masses/}
   754   \item \url{http://karlagius.com/2009/01/09/version-control-for-the-masses/}
   705   \item Articles related to version control available on \url{http://betterexplained.com/}
   755   \item Articles related to version control available on \url{http://betterexplained.com/}
   706   \item \url{http://en.wikipedia.org/wiki/Revision_control}
   756   \item \url{http://en.wikipedia.org/wiki/Revision_control}
   707   \item \url{http://wiki.alliedmods.net/Mercurial_Tutorial}
   757   \item \url{http://wiki.alliedmods.net/Mercurial_Tutorial}
       
   758   \item Mario game images are taken from wikipedia.
   708   \end{itemize}
   759   \end{itemize}
   709 \end{frame}
   760 \end{frame}
   710 \end{document}
   761 \end{document}
   711 
   762 
   712 Notes
   763 Notes