471 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
473 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
472 \end{lstlisting} %$ |
474 \end{lstlisting} %$ |
473 \end{frame} |
475 \end{frame} |
474 |
476 |
475 \begin{frame}[fragile] |
477 \begin{frame}[fragile] |
|
478 \frametitle{Merging: Scenario} |
|
479 One very useful feature is merging work of different peers working on same project.\\ |
|
480 We consider scenario, two person on one project, both have local copies, and one among them is main branch. |
|
481 \end{frame} |
|
482 |
|
483 |
|
484 \begin{frame}[fragile] |
|
485 \frametitle{Making changes to one of repo} |
|
486 \begin{lstlisting} |
|
487 $ cd Fevicol-pull |
|
488 $ echo "print 'Yeh Fevicol ka Majboot jod |
|
489 hai, tootega nahin'" > feviCol.py |
|
490 $ hg st |
|
491 M feviStick.py |
|
492 $ hg ci -u "Shantanu <shantanu@fossee.in>" |
|
493 -m "Updated tag line for feviCol.py." |
|
494 $ hg tip| grep changeset |
|
495 changeset: 4:caf986b15e05 |
|
496 \end{lstlisting} %$ |
|
497 \end{frame} |
|
498 |
|
499 \begin{frame}[fragile] |
|
500 \frametitle{In the meanwhile, other repo is ...} |
|
501 \begin{lstlisting} |
|
502 $ cd Fevicol |
|
503 $ echo "print 'Jor laga ke hayyiya'" |
|
504 > firstAdd.py |
|
505 $ hg add |
|
506 $ hg st |
|
507 A firstAdd.py |
|
508 $ hg ci -u "Shantanu <shantanu@fossee.in>" |
|
509 -m "Added firsAdd.py." |
|
510 $ hg tip|grep changeset |
|
511 changeset: 4:fadbd6492cc4 |
|
512 \end{lstlisting} |
|
513 \end{frame} |
|
514 |
|
515 \begin{frame}[fragile] |
476 \frametitle{Merging} |
516 \frametitle{Merging} |
477 |
517 \begin{lstlisting} |
478 \end{frame} |
518 $ hg pull ../Fevicol-pull |
479 |
519 pulling from ../Fevicol-pull |
480 \begin{frame}[fragile] |
520 searching for changes |
481 \frametitle{} |
521 adding changesets |
482 |
522 adding manifests |
|
523 adding file changes |
|
524 added 1 changesets with 1 changes to 1 files (+1 heads) |
|
525 (run 'hg heads' to see heads, 'hg merge' to merge) |
|
526 \end{lstlisting} %$ |
|
527 Output is already suggesting something! |
|
528 \end{frame} |
|
529 |
|
530 |
|
531 \begin{frame}[fragile] |
|
532 \frametitle{Analyzing events in detail} |
|
533 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: |
|
534 \begin{lstlisting} |
|
535 $ hg heads |
|
536 \end{lstlisting} |
|
537 This commands shows repo/branch heads. |
|
538 \begin{lstlisting} |
|
539 $ hg glog |
|
540 \end{lstlisting} |
|
541 It shows revision history alongside an ASCII revision graph.\\ |
|
542 Because of different track, \typ{up} command fails. |
|
543 \begin{lstlisting} |
|
544 $ hg up |
|
545 abort: crosses branches (use 'hg merge' or 'hg update -C') |
|
546 \end{lstlisting} %$ |
|
547 \end{frame} |
|
548 |
|
549 \begin{frame}[fragile] |
|
550 \frametitle{Merging} |
|
551 \typ{hg merge} command merge working directory with another revision. |
|
552 \begin{lstlisting} |
|
553 $ hg merge |
|
554 \end{lstlisting} %$ |
|
555 After merging two branches, we have to commit the results to create a common head. |
|
556 \begin{lstlisting} |
|
557 $ hg ci -u "Shantanu <shantanu@fossee.in>" |
|
558 -m "Merged branches." |
|
559 $ hg heads |
|
560 $ hg glog |
|
561 \end{lstlisting} %$ |
483 \end{frame} |
562 \end{frame} |
484 |
563 |
485 % Steps to follow to make life easier. How to avoid/handle manual merges. |
564 % Steps to follow to make life easier. How to avoid/handle manual merges. |
486 \section{Work flow: DOS and DON'Ts} |
565 \section{Work flow: DOS and DON'Ts} |
|
566 |
|
567 \begin{frame} |
|
568 \frametitle{Motto behind hg} |
|
569 \begin{center} |
|
570 \color{red}{``Commit Early Commit Often.''}\\ |
|
571 \end{center} |
|
572 \end{frame} |
|
573 |
|
574 \begin{frame} |
|
575 \frametitle{Steps to be followed} |
|
576 \begin{itemize} |
|
577 \item Make changes. |
|
578 \item Commit. |
|
579 \item Pull changesets. |
|
580 \item Merge if required. |
|
581 \item Push. |
|
582 \end{itemize} |
|
583 \end{frame} |
487 |
584 |
488 \begin{frame} |
585 \begin{frame} |
489 \frametitle{Suggested Readings:} |
586 \frametitle{Suggested Readings:} |
490 \begin{itemize} |
587 \begin{itemize} |
491 \item \url{http://hgbook.red-bean.com/} |
588 \item \url{http://hgbook.red-bean.com/} |