Mercurial > hg > xemacs-beta
comparison man/internals/internals.texi @ 5546:d54278e74d71
Add some working with Mercurial stuff.
author | Stephen J. Turnbull <stephen@xemacs.org> |
---|---|
date | Mon, 08 Aug 2011 23:10:47 +0900 |
parents | 3889ef128488 |
children | 56144c8593a8 |
comparison
equal
deleted
inserted
replaced
5545:69de75c48efa | 5546:d54278e74d71 |
---|---|
347 * Build-Time Dependencies:: | 347 * Build-Time Dependencies:: |
348 * The Modules of XEmacs:: | 348 * The Modules of XEmacs:: |
349 * The Build Configuration System:: | 349 * The Build Configuration System:: |
350 * Rules When Writing New C Code:: | 350 * Rules When Writing New C Code:: |
351 * Regression Testing XEmacs:: | 351 * Regression Testing XEmacs:: |
352 * Mercurial Techniques:: | |
352 * CVS Techniques:: | 353 * CVS Techniques:: |
353 * XEmacs from the Inside:: | 354 * XEmacs from the Inside:: |
354 * Basic Types:: | 355 * Basic Types:: |
355 * Low-Level Allocation:: | 356 * Low-Level Allocation:: |
356 * The XEmacs Object System (Abstractly Speaking):: | 357 * The XEmacs Object System (Abstractly Speaking):: |
439 | 440 |
440 Regression Testing XEmacs | 441 Regression Testing XEmacs |
441 | 442 |
442 * How to Regression-Test:: | 443 * How to Regression-Test:: |
443 * Modules for Regression Testing:: | 444 * Modules for Regression Testing:: |
445 | |
446 Mercurial Techniques | |
447 | |
448 * Mercurial Basics:: | |
449 * Preserving Existing Changes with Mercurial Queues:: | |
444 | 450 |
445 CVS Techniques | 451 CVS Techniques |
446 | 452 |
447 * Creating a Branch:: | 453 * Creating a Branch:: |
448 * Merging a Branch into the Trunk:: | 454 * Merging a Branch into the Trunk:: |
6354 | 6360 |
6355 @example | 6361 @example |
6356 configure --with-mule --use-union-type --error-checking=all | 6362 configure --with-mule --use-union-type --error-checking=all |
6357 @end example | 6363 @end example |
6358 | 6364 |
6359 @node Regression Testing XEmacs, CVS Techniques, Rules When Writing New C Code, Top | 6365 @node Regression Testing XEmacs, Mercurial Techniques, Rules When Writing New C Code, Top |
6360 @chapter Regression Testing XEmacs | 6366 @chapter Regression Testing XEmacs |
6361 @cindex testing, regression | 6367 @cindex testing, regression |
6362 | 6368 |
6363 @menu | 6369 @menu |
6364 * How to Regression-Test:: | 6370 * How to Regression-Test:: |
6619 @file{test-harness.el} defines the macros @code{Assert}, | 6625 @file{test-harness.el} defines the macros @code{Assert}, |
6620 @code{Check-Error}, @code{Check-Error-Message}, and | 6626 @code{Check-Error}, @code{Check-Error-Message}, and |
6621 @code{Check-Message}. The other files are test files, testing various | 6627 @code{Check-Message}. The other files are test files, testing various |
6622 XEmacs facilities. @xref{Regression Testing XEmacs}. | 6628 XEmacs facilities. @xref{Regression Testing XEmacs}. |
6623 | 6629 |
6624 @node CVS Techniques, XEmacs from the Inside, Regression Testing XEmacs, Top | 6630 @node Mercurial Techniques, CVS Techniques, Regression Testing XEmacs, Top |
6631 @chapter Mercurial Techniques | |
6632 @cindex Mercurial techniques | |
6633 | |
6634 @dfn{Mercurial} is the @emph{distributed version control system} used to | |
6635 manage the XEmacs core code. We plan to migrate the packages as well in | |
6636 the near future. The command used is @code{hg}; the entire system is | |
6637 implemented as subcommands of the @code{hg} command. | |
6638 | |
6639 @menu | |
6640 * Mercurial Basics:: | |
6641 * Preserving Existing Changes with Mercurial Queues:: | |
6642 @end menu | |
6643 | |
6644 @node Mercurial Basics, Preserving Existing Changes with Mercurial Queues, Mercurial Techniques, Mercurial Techniques | |
6645 | |
6646 @subheading Installing Mercurial | |
6647 | |
6648 Most people have some kind of package manager to help install free | |
6649 software. Invariably a reasonably fresh version of Mercurial is | |
6650 available. XEmacs doesn't do anything particularly tricky in its | |
6651 repositories, so unless you're one of those folks who likes to spend | |
6652 more time fiddling with your infrastructure than developing, the | |
6653 packaged Mercurial should be more than sufficient. Somewhat fresher | |
6654 versions may be available in prepackaged form from | |
6655 @uref{http://mercurial.selenic.com, the Mercurial Project}, if you like | |
6656 to stay on the leading edge. | |
6657 | |
6658 @subheading Documentation | |
6659 | |
6660 The primary online command for getting help on Mercurial is @code{hg | |
6661 help}. | |
6662 | |
6663 @subheading What is the XEmacs repository URL? | |
6664 | |
6665 For up-to-date information about this, other information about accessing | |
6666 the repository @strong{including making your first clone of the | |
6667 repository}, and availability of branches, please refer to our website, | |
6668 @uref{http://www.xemacs.org/Develop/hgaccess.html}. | |
6669 | |
6670 @subheading What's so special about ``distributed'' version control systems? | |
6671 | |
6672 Very little, for occasional contributors. So don't worry about it; the | |
6673 commands are you used to with CVS or Subversion will work pretty much as | |
6674 is. There are two important differences: | |
6675 | |
6676 @table @strong | |
6677 @item update | |
6678 In version control, @dfn{update} means to refresh the versions of files | |
6679 in your workspace. In a distributed system, however, there are two | |
6680 possible sources: the @dfn{project repository}, and your own @dfn{clone} | |
6681 (local repository) which is a more or less up-to-date copy of the | |
6682 project repository, including all the history information and historical | |
6683 revisions. | |
6684 | |
6685 @dfn{update} is taken to mean @emph{refresh from the clone}, and a new | |
6686 command @dfn{pull} is defined to mean @emph{copy history from the | |
6687 project repository to the clone}. Thus, to get new work from other | |
6688 contributors applied to your repository, you need to pull, then update. | |
6689 Normally the source for pull defaults to the project repository you | |
6690 cloned from, and the version to update to defaults to the @dfn{tip} | |
6691 (latest version in the clone), so in principle you can abbreviate to | |
6692 | |
6693 @example | |
6694 hg pull | |
6695 hg update | |
6696 @end example | |
6697 | |
6698 @noindent | |
6699 In fact, Mercurial allows a further abbreviation, to @code{hg pull -u}. | |
6700 | |
6701 @item commit | |
6702 The other direction is similar. The @dfn{commit} command refers to the | |
6703 @emph{clone}. A new command, @dfn{push} is used to copy local history | |
6704 to the project repository. Unlike the @code{pull} command, however, | |
6705 there is no very short way to say ``command @emph{and} push.'' | |
6706 @end table | |
6707 | |
6708 @subheading Mercurial Extensions and .hgrc | |
6709 | |
6710 Third parties provide many extensions to Mercurial. (In fact, the | |
6711 Mercurial Project often distributes new functionality as extensions, | |
6712 until the UI has stabilized.) Extensions are just as easy to use as | |
6713 core commands, and well-written extensions provide their documentation | |
6714 via @code{hg help} just like the core. The main difference is that core | |
6715 commands are always available, but extensions must be enabled. This is | |
6716 done in the extensions section of @file{~/.hgrc}. Here's one of mine: | |
6717 | |
6718 @example | |
6719 [ui] | |
6720 username = Stephen J. Turnbull <stephen@@xemacs.org> | |
6721 ignore = ~/.hgglobalignore | |
6722 | |
6723 [extensions] | |
6724 hgext.hgk = | |
6725 hgext.mq = | |
6726 hgext.rebase = | |
6727 @end example | |
6728 | |
6729 All of the extensions mentioned above are distributed with Mercurial | |
6730 itself, so enabing them is particularly simple. A locally written or | |
6731 third-party extension would have a path-to-module after the equal sign. | |
6732 The first two extensions above are recommended for all contributors. | |
6733 Some contributors may like to use the rebase extension as well, and | |
6734 sometimes it's a good way to dig yourself out of a hole. Others hate | |
6735 it; if you are thinking about using it, you should be careful, and you | |
6736 should never @code{push} a rebased branch without coordinating with the | |
6737 project. | |
6738 | |
6739 @table @code | |
6740 @item hgk | |
6741 A browser for the history graph, showing relationships among versions. | |
6742 Provides the @code{view} command. | |
6743 | |
6744 @item mq | |
6745 @emph{Mercurial queues} are a way of managing sequences of patches, | |
6746 similar to the ``quilt'' program made famous by some Linux maintainers. | |
6747 It allows you to distinguish between your local changes and ``official'' | |
6748 ones. Provides many commands beginning with the letter ``q''. | |
6749 | |
6750 @item rebase | |
6751 Rebasing is an alternative technique for managing sequences of patches. | |
6752 However, it uses branches rather than patches, and can produce a very | |
6753 confusing public history if used indiscriminately. Provides the | |
6754 @code{rebase} command. | |
6755 @end table | |
6756 | |
6757 | |
6758 @node Preserving Existing Changes with Mercurial Queues, , Mercurial Basics, Mercurial Techniques | |
6759 @section Preserving Existing Changes with Mercurial Queues | |
6760 @cindex preserving existing changes with mercurial queues | |
6761 @cindex mercurial queues, preserving existing changes with | |
6762 | |
6763 When first working with a distributed VCS, you may find yourself | |
6764 creating a series of unrelated changes in the workspace. Now you feel | |
6765 stuck: you worry that you if you commit now, you'll pull in unrelated | |
6766 changes. But Mercurial won't let you merge until you have committed? | |
6767 Here's how to use Mercurial queues to push ``just this fix'' without | |
6768 also pushing unrelated, uncommited changes also present in the | |
6769 workspace. This will also set you up for more effective workflow in the | |
6770 future. | |
6771 | |
6772 First, @emph{mq} is an extension, which must be enabled before use. Edit | |
6773 @file{$HOME/.hgrc} and add these two lines: | |
6774 | |
6775 @example | |
6776 [extensions] | |
6777 hgext.mq = | |
6778 @end example | |
6779 | |
6780 @noindent | |
6781 If you already have an [extensions] section, omit the first line. | |
6782 | |
6783 Suppose the change that you are ready to push is a check for a valid | |
6784 drive letter on the Windows platform. It affects @file{src/nt.c}, and | |
6785 of course @file{src/ChangeLog}. Assume you have no other changes to these | |
6786 files. It is important to do this step now, before handling other | |
6787 changes! (In general, it's a good idea to create your @i{mq} patches in | |
6788 approximately the order you will submit them. There are ways to | |
6789 override that order, using ``guards,'' but that's a little tedious. | |
6790 Recent versions of Mercurial queues have an option to reorder patches | |
6791 when applying them: @samp{hg qpush --move @var{patch-name}}.) | |
6792 | |
6793 Initialize an @emph{mq} patch for this change: | |
6794 | |
6795 @example | |
6796 hg qnew -f -m "Check first whether drive is valid." valid-drive \ | |
6797 src/ChangeLog src/nt.c | |
6798 @end example | |
6799 | |
6800 @noindent | |
6801 View @file{.hg/patches/valid-drive} and make sure it is the patch you | |
6802 want to push. | |
6803 | |
6804 Now make patches for other changes. For a change to @file{foo.el}, | |
6805 @file{foo-msw.el}, and @file{lisp/ChangeLog} it would look like | |
6806 | |
6807 @example | |
6808 hg qnew -f -m "Frob foo." frob-foo lisp/foo.el lisp/foo-msw.el \ | |
6809 lisp/ChangeLog | |
6810 @end example | |
6811 | |
6812 @noindent | |
6813 Do this until there are @emph{no} changes left (@kbd{hg status} reports | |
6814 no modified files). | |
6815 | |
6816 I strongly recommend that you do this @emph{now}. This is probably the | |
6817 best way to organize your work when you make many small changes. | |
6818 However, if you have overlapping changes that you can't easily sort out, | |
6819 or just don't feel like doing that, you can just | |
6820 | |
6821 @example | |
6822 hg qnew -f -m "DON'T COMMIT ME!" big-ball-of-mud | |
6823 @end example | |
6824 | |
6825 @noindent | |
6826 instead. | |
6827 | |
6828 Now let's commit the patch you want to push. If you feel paranoid, you | |
6829 can view all the patches in @file{.hg/patches} to make sure they look | |
6830 OK. | |
6831 | |
6832 @example | |
6833 hg qpop --all # unapply --all patches | |
6834 hg status # should report no modified files | |
6835 hg qpush # note, no argument needed | |
6836 hg qapplied # will report "valid-drive" because that was | |
6837 # the first patch you created (it's a queue!!) | |
6838 hg qfinish --applied # convert valid-drive from a patch to a commit | |
6839 # Make sure it's OK. | |
6840 hg log -r tip # message you gave in 'qnew -m' is the | |
6841 # log message | |
6842 @end example | |
6843 | |
6844 @noindent | |
6845 Update and push. | |
6846 | |
6847 @example | |
6848 hg pull -u # should work without complaint since you | |
6849 # don't say you have any commits | |
6850 hg push # Yay! | |
6851 @end example | |
6852 | |
6853 That looks like a lot of work, but it's actually not too inconvenient. | |
6854 | |
6855 After this, whenever you have something that could turn into a | |
6856 commitable change, do "@kbd{hg qnew ...}". Make the @file{ChangeLog} | |
6857 right away (it can even just be a placeholder to fill in later). That | |
6858 allows you to isolate this change from other changes, even if they touch | |
6859 the same files. | |
6860 | |
6861 | |
6862 @node CVS Techniques, XEmacs from the Inside, Mercurial Techniques, Top | |
6625 @chapter CVS Techniques | 6863 @chapter CVS Techniques |
6626 @cindex CVS techniques | 6864 @cindex CVS techniques |
6865 | |
6866 This section is obsolete for core XEmacs; we now use Mercurial | |
6867 @ref{Mercurial Techniques}. However these may be of some use for the | |
6868 packages, which are still in CVS for the moment. | |
6627 | 6869 |
6628 @menu | 6870 @menu |
6629 * Creating a Branch:: | 6871 * Creating a Branch:: |
6630 * Merging a Branch into the Trunk:: | 6872 * Merging a Branch into the Trunk:: |
6631 @end menu | 6873 @end menu |