equal
deleted
inserted
replaced
129 :: |
129 :: |
130 |
130 |
131 $ cd book/ |
131 $ cd book/ |
132 $ ls -a |
132 $ ls -a |
133 . .. chapter1.txt chapter2.txt chapter3.txt |
133 . .. chapter1.txt chapter2.txt chapter3.txt |
134 $ |
134 |
135 |
135 |
136 We have three chapters in the folder. We convert this folder into a mercurial |
136 We have three chapters in the folder. We convert this folder into a mercurial |
137 repository using the ``hg init`` command |
137 repository using the ``hg init`` command |
138 |
138 |
139 :: |
139 :: |
140 |
140 |
141 $ hg init |
141 $ hg init |
142 $ ls -a |
142 $ ls -a |
143 . .. .hg chapter1.txt chapter2.txt chapter3.txt |
143 . .. .hg chapter1.txt chapter2.txt chapter3.txt |
144 $ |
144 |
145 |
145 |
146 The ``.hg`` directory indicates that our book directory is now a ``hg`` |
146 The ``.hg`` directory indicates that our book directory is now a ``hg`` |
147 repository. Mercurial keeps all the history of the changes made, and a few |
147 repository. Mercurial keeps all the history of the changes made, and a few |
148 other config files, etc. in this directory. The directory, ``book`` is called |
148 other config files, etc. in this directory. The directory, ``book`` is called |
149 our **working directory**. |
149 our **working directory**. |
201 adding chapter3.txt |
201 adding chapter3.txt |
202 $ hg status |
202 $ hg status |
203 A chapter1.txt |
203 A chapter1.txt |
204 A chapter2.txt |
204 A chapter2.txt |
205 A chapter3.txt |
205 A chapter3.txt |
206 $ |
|
207 |
206 |
208 This simply adds all the files in the (working) directory, to the repository. |
207 This simply adds all the files in the (working) directory, to the repository. |
209 As expected, the ``status`` command shows an ``A`` before he file names. We |
208 As expected, the ``status`` command shows an ``A`` before he file names. We |
210 could also specify files individually, for example |
209 could also specify files individually, for example |
211 |
210 |
245 use the ``hg status`` command. |
244 use the ``hg status`` command. |
246 |
245 |
247 :: |
246 :: |
248 |
247 |
249 $ hg st |
248 $ hg st |
250 $ |
|
251 |
249 |
252 The command does not return anything, when there are no uncommitted changes. |
250 The command does not return anything, when there are no uncommitted changes. |
253 Also, notice that I have started getting lazy and used only a short name |
251 Also, notice that I have started getting lazy and used only a short name |
254 ``st`` for the status command. Mercurial accepts short names, as long as they |
252 ``st`` for the status command. Mercurial accepts short names, as long as they |
255 can be disambiguated (just like tab completion). |
253 can be disambiguated (just like tab completion). |
360 |
358 |
361 $ rm chapter3.txt |
359 $ rm chapter3.txt |
362 $ hg st |
360 $ hg st |
363 M chapter1.txt |
361 M chapter1.txt |
364 ! chapter3.txt |
362 ! chapter3.txt |
365 $ |
|
366 |
363 |
367 |
364 |
368 But after a while, you realize that these changes are unwarranted. You |
365 But after a while, you realize that these changes are unwarranted. You |
369 want to go back to the previous state, undoing all the changes that |
366 want to go back to the previous state, undoing all the changes that |
370 you made, after your friend arrived. |
367 you made, after your friend arrived. |
400 :: |
397 :: |
401 |
398 |
402 $ mv chapter1.txt.orig chapter1.txt |
399 $ mv chapter1.txt.orig chapter1.txt |
403 $ hg st |
400 $ hg st |
404 M chapter1.txt |
401 M chapter1.txt |
405 $ |
|
406 |
402 |
407 Viewing Changes |
403 Viewing Changes |
408 --------------- |
404 --------------- |
409 |
405 |
410 Let's say we now want to ``commit`` these changes, but we are not sure |
406 Let's say we now want to ``commit`` these changes, but we are not sure |
621 3 Revision history |
617 3 Revision history |
622 4 Making and sharing changes |
618 4 Making and sharing changes |
623 -5 Merges and Conflicts |
619 -5 Merges and Conflicts |
624 +5 Getting repositories |
620 +5 Getting repositories |
625 +6 Merges and Conflicts |
621 +6 Merges and Conflicts |
626 $ |
|
627 |
622 |
628 He then commits these changes and **pushes** them to the central repository |
623 He then commits these changes and **pushes** them to the central repository |
629 that we have created. |
624 that we have created. |
630 |
625 |
631 :: |
626 :: |
730 $ hg parent |
725 $ hg parent |
731 changeset: 2:98f7f4a1bb4d |
726 changeset: 2:98f7f4a1bb4d |
732 user: Puneeth Chaganti <punchagan@fossee.in> |
727 user: Puneeth Chaganti <punchagan@fossee.in> |
733 date: Fri Jan 28 16:24:42 2011 +0530 |
728 date: Fri Jan 28 16:24:42 2011 +0530 |
734 summary: Replace all occurrences of & with and |
729 summary: Replace all occurrences of & with and |
735 $ |
|
736 |
730 |
737 As we can see, the parent is still our last commit, and the changes made by |
731 As we can see, the parent is still our last commit, and the changes made by |
738 Madhusudan are still not in our working directory. To get these changes we do |
732 Madhusudan are still not in our working directory. To get these changes we do |
739 the update as suggested by ``hg``. |
733 the update as suggested by ``hg``. |
740 |
734 |
747 tag: tip |
741 tag: tip |
748 user: Madhusudan CS <madhusudancs@fossee.in> |
742 user: Madhusudan CS <madhusudancs@fossee.in> |
749 date: Fri Jan 28 23:08:25 2011 +0530 |
743 date: Fri Jan 28 23:08:25 2011 +0530 |
750 summary: Add my name to authors and move getting repositories section |
744 summary: Add my name to authors and move getting repositories section |
751 to 5 |
745 to 5 |
752 $ |
|
753 |
746 |
754 As expected the **update** command updates the parent to the latest changes |
747 As expected the **update** command updates the parent to the latest changes |
755 that we just pulled from the remote repository. |
748 that we just pulled from the remote repository. |
756 |
749 |
757 The update command can also be used to go back into an older revision, by |
750 The update command can also be used to go back into an older revision, by |
781 tag: tip |
774 tag: tip |
782 user: Madhusudan CS <madhusudancs@fossee.in> |
775 user: Madhusudan CS <madhusudancs@fossee.in> |
783 date: Fri Jan 28 23:08:25 2011 +0530 |
776 date: Fri Jan 28 23:08:25 2011 +0530 |
784 summary: Add my name to authors and move getting repositories section |
777 summary: Add my name to authors and move getting repositories section |
785 to 5 |
778 to 5 |
786 $ |
|
787 |
779 |
788 Simultaneous Changes |
780 Simultaneous Changes |
789 -------------------- |
781 -------------------- |
790 |
782 |
791 Ok, we have been talking about collaboration, but this is a nice situation, |
783 Ok, we have been talking about collaboration, but this is a nice situation, |
815 searching for changes |
807 searching for changes |
816 adding changesets |
808 adding changesets |
817 adding manifests |
809 adding manifests |
818 adding file changes |
810 adding file changes |
819 added 1 changesets with 1 changes to 1 files |
811 added 1 changesets with 1 changes to 1 files |
820 $ |
|
821 |
812 |
822 Also, let us assume Madhusudan adds an additional section called References. |
813 Also, let us assume Madhusudan adds an additional section called References. |
823 :: |
814 :: |
824 |
815 |
825 $ hg diff |
816 $ hg diff |
873 added 1 changesets with 1 changes to 1 files (+1 heads) |
864 added 1 changesets with 1 changes to 1 files (+1 heads) |
874 (run 'hg heads' to see heads, 'hg merge' to merge) |
865 (run 'hg heads' to see heads, 'hg merge' to merge) |
875 $ hg merge |
866 $ hg merge |
876 merging chapter1.txt |
867 merging chapter1.txt |
877 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
868 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
878 (branch merge, don't forget to commit) |
869 (branch merge, dont forget to commit) |
|
870 |
879 |
871 |
880 We have now pull the changes from the central repository and merged them with |
872 We have now pull the changes from the central repository and merged them with |
881 the changes in our repository. But, ``hg`` is warning us not to forget to |
873 the changes in our repository. But, ``hg`` is warning us not to forget to |
882 commit. Let's see what is the status of the repository at this point in time. |
874 commit. Let's see what is the status of the repository at this point in time. |
883 |
875 |
884 :: |
876 :: |
885 |
877 |
886 $ hg st |
878 $ hg st |
887 M chapter1.txt |
879 M chapter1.txt |
997 ... |
989 ... |
998 added 1 changesets with 1 changes to 1 files (+1 heads) |
990 added 1 changesets with 1 changes to 1 files (+1 heads) |
999 (run 'hg heads' to see heads, 'hg merge' to merge) |
991 (run 'hg heads' to see heads, 'hg merge' to merge) |
1000 $ hg merge |
992 $ hg merge |
1001 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
993 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
1002 (branch merge, don't forget to commit) |
994 (branch merge, dont forget to commit) |
1003 |
995 |
1004 |
996 |
1005 What happens now actually depends on how Mercurial is configured and the |
997 What happens now actually depends on how Mercurial is configured and the |
1006 programs available in your machine. You will either get a diff view with 3 |
998 programs available in your machine. You will either get a diff view with 3 |
1007 panes or ``merge`` will insert markers in your file at the points where the |
999 panes or ``merge`` will insert markers in your file at the points where the |