Difference between revisions of "Mercurial"

From Octave
Jump to navigation Jump to search
Line 4: Line 4:
  
 
{{Note|[https://tortoisehg.bitbucket.io/ TortoiseHg] is a GUI for Mercurial and it is especially recommended for users doing their first steps with source code management systems.  Linux, macOS, and MS Windows are supported.}}
 
{{Note|[https://tortoisehg.bitbucket.io/ TortoiseHg] is a GUI for Mercurial and it is especially recommended for users doing their first steps with source code management systems.  Linux, macOS, and MS Windows are supported.}}
 +
 +
== Creating and submitting patches (changesets) ==
 +
 +
If you want to share your modifications, for example to fix a nasty '''bug #42424''', you cannot just submit your changes to Octave's main repository.  You have to generate a '''patch (or changeset)''' so other Octave developers can include them into Octave's source code.
 +
 +
# Get the latest version of Octave (or some Octave package) <pre>hg clone https://www.octave.org/hg/octave</pre> or when already cloned <pre>hg pull && hg update</pre>
 +
# Make your changes (fix bug #42424) and save them.  '''Make sure that your changes don't introduce new bugs!'''  Thus it is recommended to [[Building | build Octave]] and to [[Tests | run Octave's test suite]] before proceeding.<br>{{Warning|Please follow the [[Contribution guidelines]] for C/C++ or Octave code files!}}
 +
# Commit your changes <pre>hg commit</pre> Mercurial will open your default editor<ref>To set your default Mercurial editor, read https://www.mercurial-scm.org/wiki/editor .</ref> and ask you for a commit message.  Please follow the [[commit message guidelines]], e.g. <syntaxhighlight lang="text">help.m: Display relevant topics first (bug #42424)
 +
 +
* scripts/help/help.m: Describe what you changed to display relevant topics
 +
  first.  The maximal line width is 80 characters.</syntaxhighlight>
 +
# Export the changes <pre>hg export -r tip -o bug42424.patch</pre> The final patch for submission will look like this {{file|bug42424.patch|<syntaxhighlight lang="diff"># HG changeset patch
 +
# User Awesome Hacker <awesome@hacker.com>
 +
# Date 1591780091 -32400
 +
#      Wed Jun 10 18:08:11 2020 +0100
 +
# Node ID 68c698c4f2fd98bf2d48234bd1da99e91763114f
 +
# Parent  f5c9bb5955e7c9fddef5c3c3f115201e11b43b79
 +
help.m: Display relevant topics first (bug #42424)

Revision as of 04:39, 12 February 2021

Mercurial (sometimes referred to as hg) is the source code management system used for Octave development.

Everybody is free to run, copy, distribute, study, change and improve[1] Octave's source code, given in the main repository at https://www.octave.org/hg/octave. Use Mercurial to get the latest version of Octave

hg clone https://www.octave.org/hg/octave
Info icon.svg
TortoiseHg is a GUI for Mercurial and it is especially recommended for users doing their first steps with source code management systems. Linux, macOS, and MS Windows are supported.

Creating and submitting patches (changesets)

If you want to share your modifications, for example to fix a nasty bug #42424, you cannot just submit your changes to Octave's main repository. You have to generate a patch (or changeset) so other Octave developers can include them into Octave's source code.

  1. Get the latest version of Octave (or some Octave package)
    hg clone https://www.octave.org/hg/octave
    or when already cloned
    hg pull && hg update
  2. Make your changes (fix bug #42424) and save them. Make sure that your changes don't introduce new bugs! Thus it is recommended to build Octave and to run Octave's test suite before proceeding.
    Warning icon.svg
    Please follow the Contribution guidelines for C/C++ or Octave code files!
  3. Commit your changes
    hg commit
    Mercurial will open your default editor[2] and ask you for a commit message. Please follow the commit message guidelines, e.g.
    help.m: Display relevant topics first (bug #42424)
    
    * scripts/help/help.m: Describe what you changed to display relevant topics
      first.  The maximal line width is 80 characters.
    
  4. Export the changes
    hg export -r tip -o bug42424.patch
    The final patch for submission will look like this {{file|bug42424.patch|<syntaxhighlight lang="diff"># HG changeset patch
  5. User Awesome Hacker <awesome@hacker.com>
  6. Date 1591780091 -32400
  7. Wed Jun 10 18:08:11 2020 +0100
  8. Node ID 68c698c4f2fd98bf2d48234bd1da99e91763114f
  9. Parent f5c9bb5955e7c9fddef5c3c3f115201e11b43b79

help.m: Display relevant topics first (bug #42424)