ก�����ก�������������� Mercurial Mercurial ก�����ก�������������� �������ก���ก���ก������ก�������������� �������ก���ก���ก������ก�������������� (01204223) (01204223) ��.��.����� !"#ก$� %����������ก�������������� �&'����ก�����(��� �)���*��+���ก,����(��� 1
�������� Development Timeline revision 1: revision 2: revision 5: .ก�2�3ก X .ก�2�3ก Y .ก�2�3ก Z Development Timeline revision 0: revision 3: revision 4: ��������.�ก/0� �&'()*+����� A �&'()*+����� B ��������: (�������ก������ revision) 2
��������;�*��.������ก���������� � #������-.�� (�� repo* ก+�4*������) Repo � CVS 8 Concurrent Versions System � SVN 8 Apache Subversion �-$��H.� �-$��H.� �-$��H.� � #��ก�'"�� (repo �����-Gก���-$��H.�) � Git Repo Repo � Mercurial �-$��H.� �-$��H.� Repo Repo �-$��H.� �-$��H.� *Repo = Repository " #$���ก���%&'()�� 3
Workflow � �'��"��ก���������.#������-.�� Repo update t i m (centralized version control system) m c update o o m c m i t src src code code �-$��H.� �-$��H.� � �'��"��ก���������.#��ก�'"�� (distributed version control system) commit/update commit/update push / pull / clone src Repo Repo src code code �-$��H.� �-$��H.� 4
Mercurial � N�O��#���"��ก���������.#��ก�'"�� � (�44�.�$�� CommandPLine � �� GUI frontend ��ก��� � TortoiseHg (Windows/Linux/Mac OS) � MacHg (Mac OS X 10.6+) � �-��������*� http://mercurial.selenic.com/wiki/OtherTools 5
/���@�Aก�2BC�กD��ก�����ก���������� D��H��)/�0@ก��.ก�FD �b���-$*�#ก$cd (commit message) ��C�GE(.ก� ���ก��������. ���CA��E���E�'��� F*C�GE()Eก���@CE(��.@C� revision = changeset 6
���E�)���L�� Mercurial � (�$�4cO+� .hgrc !.ef�c���������d�4�.��b���'�g �b��#+'����+� � ก��กd$��-+�G�c�.�h+4!.cO+� e��!(G�b��#+'����+� ���������i."��4 [ui] username = Firstname Lastname < email@some.where > � �b��.�h"'j-ก��.*kก��i.�-$"���กl�������. 7
���ก����������LB� myweb � (�$�4 mercurial repository !.c�������� myweb $ cd myweb $ hg init � ��ก mercurial !)$c�G�$�4(.!"cO+� *.pyc � (�$�4cO+� .hgignore c�$!. myweb e����d$����� syntax: glob *.pyc 8
����/�2/O��Aก�����ก���������� � !�$�m�(�4 hg status ��b���-(j�.'ก��"��ก���������.d�4 cO+�!.e���"l� $ hg status ? .hgignore ? __init__.py ? manage.py ? settings.py ? shape/__init__.py ? shape/models.py ���b��4)��� ? #(�4jk4ก��*�cO+� ? shape/tests.py .�h.��4c�Gj-ก"��ก���������. ? shape/views.py ? templates/index.html ? templates/rectangle.html ? templates/result.html ? urls.py 9
�A20F*C�GE(����ก�����ก���������� � �m�(�4 hg add !�$��ก!)$ mercurial ����"��ก���������.!)$cO+� � ����cO+�*�h4)��*���4c�Gj-ก"��ก���������. $ hg add � ����e���'�g�b��cO+� $ hg add manage.py settings.py � ����cO+� *.py *gกcO+�!.c���������o""g��. $ hg add -I '*.py' � ����cO+� *.py *gกcO+�!.c���������o""g��.#+'N��c��������*�h4)�� $ hg add -I '**.py' � ����cO+�*gกcO+�*���4c�Gj-ก"��ก�� �ก��$.cO+�*�+4*$���$�� .html $ hg add -X '**.html' 10
Commit Q 2��GRก�E�'��� � ��.*kกe�$��o""g��.��i.������.!)�Ge��!�$�m�(�4 commit � ������"(��(j�.'cO+�กG�.e��!�$�m�(�4 status $ hg status A .hgignore A __init__.py A manage.py A settings.py A shape/__init__.py A shape/models.py A shape/tests.py Commit Message B�S�D��H��)./��ก��.ก�FD A shape/views.py A templates/index.html H��LB�ก�A��2.CAF��L�H��) ���� "Fix bug W" A templates/rectangle.html "Add feature W" A templates/result.html A urls.py $ hg commit –m "First revision" $ hg status $ YCC�&Z���ก hg status ./��LB��B\����F)��BCS� F*C�GE(O]ก.ก�FD.�����F)�F���ก\2C��@^��E�'��� 11
Commit .22�CS�กF*C� � ���c�G"m���i.�$�4 commit *gกcO+�*���ก����+��.#�+4+4!.�� ����.����� $ hg status M shape/views.py �CS�ก commit �&E��/��F*C� ��+��.#�+4 4 cO+� M templates/rectangle.html A templates/triangle.html (#ก$ 3 ���� 1) M urls.py $ hg commit –m "Fix incorrect URL" shape/views.py urls.py $ hg status �)+b� 2 ก��#ก$cd M templates � rectangle � html *���4c�Gj-ก��.*kก A templates � triangle.html ��i.������. $ � ���p����.����������*��� #�G+'������.d�4N�O��#������ *m�4�.c�$(��-�&�!.�����4 � ��G.#ก$��qก�(�l" 1 #)G4)�b�����Or�"��� 1 ��G�4 � c�G���!�$��i.*��กl�cO+�*��NO��k�4 s ก+�4 s 12
�����]���ก���E�'��� � !�$�m�(�4 log C_���2/B)���CD�E�'��� $ hg log changeset: 0:87ad7f0fe866 �S(�Y]�2��GRก�E�'��� tag: tip user: Chaiporn Jaikaeo <chaiporn.j@ku.ac.th> date: Wed Jul 06 22:07:35 2011 +0700 summary: First revision ��C�GE(2��GRก Commit message � !�$*�4�+b�ก Pv ��b��#(�4cO+�*�#ก$cd#+'j-ก��.*kก+4 !.#�G+'������. $ hg -v log 13
TortoiseHg � !)$�-$!�$(�44�. Mercurial �G�. GUI � !�$�m�(�4 hgtk #*.*� hg c�$ก���m�(�4(G�.!)tG $ hgtk add $ hgtk status $ hgtk commit $ hgtk log 14
���E�) repository 2��;'��*����� � !�$ ssh �d$�c���4���b��4 cloud28 ��b��(�$�4 hg repository c�$ �กl�e���"l�d�4�. $ ssh username @cloud28.cpe.ku.ac.th Password: : (��..�h��-G*����b��4 cloud28) $ mkdir hg $ cd hg $ hg init myweb $ logout � !�$�m�(�4 push *����b��4�.��4��b��(G4d$��-+������.*�h4)��c�c�$ �.���b��4 cloud28 $ hg push ssh:// username @cloud28.cpe.ku.ac.th/hg/myweb 15
ก��bHC�.CA�R� repository � !�$�m�(�4 clone ��b���k4 repository *�h4ก$�.����H.��G� �.���b��4*�c�G��e���"l���-GกG�. $ hg clone ssh:// username @cloud28.cpe.ku.ac.th/hg/myweb � !�$�m�(�4 pull ��b��!)$ repository !.���b��4��d$��-+������. +G�(g����*���-G�.�N���O����� $ hg pull ssh:// username @cloud28.cpe.ku.ac.th/hg/myweb 16
ก��/C�2�E�'��� � !�$�m�(�4 update ��b����+��.e�$��o""g��.c���i.e�$� & ��+�*�������.j-ก(�$�4dkh. � ����e�$�c���i.e�$�d�4������.*� 3 $ hg update 3 � ����e�$�c���i.e�$�d�4������.+G�(g� $ hg update 17
;�*��.���GE(&�c��BC��H� � (�4 merge ��b�������'����������.�G�4ก�.�d$��$��ก�. commit commit �H�S(��D�� Jittat Repo push push clone pull Timeline Repo �;'��*�����กC�� push push clone pull pull Repo commit commit merge �H�S(��D�� Chaiporn 18
Recommend
More recommend