##// END OF EJS Templates
mq: wrap docstrings at 70 characters
Martin Geisler -
r9265:39426716 default
parent child Browse files
Show More
@@ -8,11 +8,11 b''
8 8 '''manage a stack of patches
9 9
10 10 This extension lets you work with a stack of patches in a Mercurial
11 repository. It manages two stacks of patches - all known patches, and applied
12 patches (subset of known patches).
11 repository. It manages two stacks of patches - all known patches, and
12 applied patches (subset of known patches).
13 13
14 Known patches are represented as patch files in the .hg/patches directory.
15 Applied patches are both patch files and changesets.
14 Known patches are represented as patch files in the .hg/patches
15 directory. Applied patches are both patch files and changesets.
16 16
17 17 Common tasks (use "hg help command" for more details)::
18 18
@@ -1683,26 +1683,29 b' def unapplied(ui, repo, patch=None, **op'
1683 1683 def qimport(ui, repo, *filename, **opts):
1684 1684 """import a patch
1685 1685
1686 The patch is inserted into the series after the last applied patch. If no
1687 patches have been applied, qimport prepends the patch to the series.
1686 The patch is inserted into the series after the last applied
1687 patch. If no patches have been applied, qimport prepends the patch
1688 to the series.
1688 1689
1689 The patch will have the same name as its source file unless you give it a
1690 new one with -n/--name.
1690 The patch will have the same name as its source file unless you
1691 give it a new one with -n/--name.
1691 1692
1692 You can register an existing patch inside the patch directory with the
1693 -e/--existing flag.
1693 You can register an existing patch inside the patch directory with
1694 the -e/--existing flag.
1694 1695
1695 With -f/--force, an existing patch of the same name will be overwritten.
1696 With -f/--force, an existing patch of the same name will be
1697 overwritten.
1696 1698
1697 An existing changeset may be placed under mq control with -r/--rev (e.g.
1698 qimport --rev tip -n patch will place tip under mq control). With
1699 -g/--git, patches imported with --rev will use the git diff format. See
1700 the diffs help topic for information on why this is important for
1701 preserving rename/copy information and permission changes.
1699 An existing changeset may be placed under mq control with -r/--rev
1700 (e.g. qimport --rev tip -n patch will place tip under mq control).
1701 With -g/--git, patches imported with --rev will use the git diff
1702 format. See the diffs help topic for information on why this is
1703 important for preserving rename/copy information and permission
1704 changes.
1702 1705
1703 To import a patch from standard input, pass - as the patch file. When
1704 importing from standard input, a patch name must be specified using the
1705 --name flag.
1706 To import a patch from standard input, pass - as the patch file.
1707 When importing from standard input, a patch name must be specified
1708 using the --name flag.
1706 1709 """
1707 1710 q = repo.mq
1708 1711 q.qimport(repo, filename, patchname=opts['name'],
@@ -1717,12 +1720,11 b' def qimport(ui, repo, *filename, **opts)'
1717 1720 def init(ui, repo, **opts):
1718 1721 """init a new queue repository
1719 1722
1720 The queue repository is unversioned by default. If -c/--create-repo is
1721 specified, qinit will create a separate nested repository for patches
1722 (qinit -c may also be run later to convert an unversioned patch repository
1723 into a versioned one). You can use qcommit to commit changes to this queue
1724 repository.
1725 """
1723 The queue repository is unversioned by default. If
1724 -c/--create-repo is specified, qinit will create a separate nested
1725 repository for patches (qinit -c may also be run later to convert
1726 an unversioned patch repository into a versioned one). You can use
1727 qcommit to commit changes to this queue repository."""
1726 1728 q = repo.mq
1727 1729 r = q.init(repo, create=opts['create_repo'])
1728 1730 q.save_dirty()
@@ -1744,16 +1746,17 b' def init(ui, repo, **opts):'
1744 1746 def clone(ui, source, dest=None, **opts):
1745 1747 '''clone main and patch repository at same time
1746 1748
1747 If source is local, destination will have no patches applied. If source is
1748 remote, this command can not check if patches are applied in source, so
1749 cannot guarantee that patches are not applied in destination. If you clone
1750 remote repository, be sure before that it has no patches applied.
1749 If source is local, destination will have no patches applied. If
1750 source is remote, this command can not check if patches are
1751 applied in source, so cannot guarantee that patches are not
1752 applied in destination. If you clone remote repository, be sure
1753 before that it has no patches applied.
1751 1754
1752 Source patch repository is looked for in <src>/.hg/patches by default. Use
1753 -p <url> to change.
1755 Source patch repository is looked for in <src>/.hg/patches by
1756 default. Use -p <url> to change.
1754 1757
1755 The patch directory must be a nested Mercurial repository, as would be
1756 created by qinit -c.
1758 The patch directory must be a nested Mercurial repository, as
1759 would be created by qinit -c.
1757 1760 '''
1758 1761 def patchdir(repo):
1759 1762 url = repo.url()
@@ -1859,24 +1862,26 b' def setupheaderopts(ui, opts):'
1859 1862 def new(ui, repo, patch, *args, **opts):
1860 1863 """create a new patch
1861 1864
1862 qnew creates a new patch on top of the currently-applied patch (if any).
1863 It will refuse to run if there are any outstanding changes unless
1864 -f/--force is specified, in which case the patch will be initialized with
1865 them. You may also use -I/--include, -X/--exclude, and/or a list of files
1866 after the patch name to add only changes to matching files to the new
1867 patch, leaving the rest as uncommitted modifications.
1865 qnew creates a new patch on top of the currently-applied patch (if
1866 any). It will refuse to run if there are any outstanding changes
1867 unless -f/--force is specified, in which case the patch will be
1868 initialized with them. You may also use -I/--include,
1869 -X/--exclude, and/or a list of files after the patch name to add
1870 only changes to matching files to the new patch, leaving the rest
1871 as uncommitted modifications.
1868 1872
1869 -u/--user and -d/--date can be used to set the (given) user and date,
1870 respectively. -U/--currentuser and -D/--currentdate set user to current
1871 user and date to current date.
1873 -u/--user and -d/--date can be used to set the (given) user and
1874 date, respectively. -U/--currentuser and -D/--currentdate set user
1875 to current user and date to current date.
1872 1876
1873 -e/--edit, -m/--message or -l/--logfile set the patch header as well as
1874 the commit message. If none is specified, the header is empty and the
1875 commit message is '[mq]: PATCH'.
1877 -e/--edit, -m/--message or -l/--logfile set the patch header as
1878 well as the commit message. If none is specified, the header is
1879 empty and the commit message is '[mq]: PATCH'.
1876 1880
1877 Use the -g/--git option to keep the patch in the git extended diff format.
1878 Read the diffs help topic for more information on why this is important
1879 for preserving permission changes and copy/rename information.
1881 Use the -g/--git option to keep the patch in the git extended diff
1882 format. Read the diffs help topic for more information on why this
1883 is important for preserving permission changes and copy/rename
1884 information.
1880 1885 """
1881 1886 msg = cmdutil.logmessage(opts)
1882 1887 def getmsg(): return ui.edit(msg, ui.username())
@@ -1894,16 +1899,17 b' def new(ui, repo, patch, *args, **opts):'
1894 1899 def refresh(ui, repo, *pats, **opts):
1895 1900 """update the current patch
1896 1901
1897 If any file patterns are provided, the refreshed patch will contain only
1898 the modifications that match those patterns; the remaining modifications
1899 will remain in the working directory.
1902 If any file patterns are provided, the refreshed patch will
1903 contain only the modifications that match those patterns; the
1904 remaining modifications will remain in the working directory.
1900 1905
1901 If -s/--short is specified, files currently included in the patch will be
1902 refreshed just like matched files and remain in the patch.
1906 If -s/--short is specified, files currently included in the patch
1907 will be refreshed just like matched files and remain in the patch.
1903 1908
1904 hg add/remove/copy/rename work as usual, though you might want to use
1905 git-style patches (-g/--git or [diff] git=1) to track copies and renames.
1906 See the diffs help topic for more information on the git diff format.
1909 hg add/remove/copy/rename work as usual, though you might want to
1910 use git-style patches (-g/--git or [diff] git=1) to track copies
1911 and renames. See the diffs help topic for more information on the
1912 git diff format.
1907 1913 """
1908 1914 q = repo.mq
1909 1915 message = cmdutil.logmessage(opts)
@@ -1924,13 +1930,15 b' def refresh(ui, repo, *pats, **opts):'
1924 1930 def diff(ui, repo, *pats, **opts):
1925 1931 """diff of the current patch and subsequent modifications
1926 1932
1927 Shows a diff which includes the current patch as well as any changes which
1928 have been made in the working directory since the last refresh (thus
1929 showing what the current patch would become after a qrefresh).
1933 Shows a diff which includes the current patch as well as any
1934 changes which have been made in the working directory since the
1935 last refresh (thus showing what the current patch would become
1936 after a qrefresh).
1930 1937
1931 Use 'hg diff' if you only want to see the changes made since the last
1932 qrefresh, or 'hg export qtip' if you want to see changes made by the
1933 current patch without including changes made since the qrefresh.
1938 Use 'hg diff' if you only want to see the changes made since the
1939 last qrefresh, or 'hg export qtip' if you want to see changes made
1940 by the current patch without including changes made since the
1941 qrefresh.
1934 1942 """
1935 1943 repo.mq.diff(repo, pats, opts)
1936 1944 return 0
@@ -1938,15 +1946,15 b' def diff(ui, repo, *pats, **opts):'
1938 1946 def fold(ui, repo, *files, **opts):
1939 1947 """fold the named patches into the current patch
1940 1948
1941 Patches must not yet be applied. Each patch will be successively applied
1942 to the current patch in the order given. If all the patches apply
1943 successfully, the current patch will be refreshed with the new cumulative
1944 patch, and the folded patches will be deleted. With -k/--keep, the folded
1945 patch files will not be removed afterwards.
1949 Patches must not yet be applied. Each patch will be successively
1950 applied to the current patch in the order given. If all the
1951 patches apply successfully, the current patch will be refreshed
1952 with the new cumulative patch, and the folded patches will be
1953 deleted. With -k/--keep, the folded patch files will not be
1954 removed afterwards.
1946 1955
1947 The header for each folded patch will be concatenated with the current
1948 patch header, separated by a line of '* * *'.
1949 """
1956 The header for each folded patch will be concatenated with the
1957 current patch header, separated by a line of '* * *'."""
1950 1958
1951 1959 q = repo.mq
1952 1960
@@ -2012,13 +2020,14 b' def goto(ui, repo, patch, **opts):'
2012 2020 def guard(ui, repo, *args, **opts):
2013 2021 '''set or print guards for a patch
2014 2022
2015 Guards control whether a patch can be pushed. A patch with no guards is
2016 always pushed. A patch with a positive guard ("+foo") is pushed only if
2017 the qselect command has activated it. A patch with a negative guard
2018 ("-foo") is never pushed if the qselect command has activated it.
2023 Guards control whether a patch can be pushed. A patch with no
2024 guards is always pushed. A patch with a positive guard ("+foo") is
2025 pushed only if the qselect command has activated it. A patch with
2026 a negative guard ("-foo") is never pushed if the qselect command
2027 has activated it.
2019 2028
2020 With no arguments, print the currently active guards. With arguments, set
2021 guards for the named patch.
2029 With no arguments, print the currently active guards.
2030 With arguments, set guards for the named patch.
2022 2031 NOTE: Specifying negative guards now requires '--'.
2023 2032
2024 2033 To set guards on another patch:
@@ -2095,8 +2104,8 b' def savename(path):'
2095 2104 def push(ui, repo, patch=None, **opts):
2096 2105 """push the next patch onto the stack
2097 2106
2098 When -f/--force is applied, all local changes in patched files will be
2099 lost.
2107 When -f/--force is applied, all local changes in patched files
2108 will be lost.
2100 2109 """
2101 2110 q = repo.mq
2102 2111 mergeq = None
@@ -2118,9 +2127,9 b' def push(ui, repo, patch=None, **opts):'
2118 2127 def pop(ui, repo, patch=None, **opts):
2119 2128 """pop the current patch off the stack
2120 2129
2121 By default, pops off the top of the patch stack. If given a patch name,
2122 keeps popping off patches until the named patch is at the top of the
2123 stack.
2130 By default, pops off the top of the patch stack. If given a patch
2131 name, keeps popping off patches until the named patch is at the
2132 top of the stack.
2124 2133 """
2125 2134 localupdate = True
2126 2135 if opts['name']:
@@ -2237,7 +2246,8 b' def strip(ui, repo, rev, **opts):'
2237 2246 """strip a revision and all its descendants from the repository
2238 2247
2239 2248 If one of the working directory's parent revisions is stripped, the
2240 working directory will be updated to the parent of the stripped revision.
2249 working directory will be updated to the parent of the stripped
2250 revision.
2241 2251 """
2242 2252 backup = 'all'
2243 2253 if opts['backup']:
@@ -2262,33 +2272,35 b' def strip(ui, repo, rev, **opts):'
2262 2272 def select(ui, repo, *args, **opts):
2263 2273 '''set or print guarded patches to push
2264 2274
2265 Use the qguard command to set or print guards on patch, then use qselect
2266 to tell mq which guards to use. A patch will be pushed if it has no guards
2267 or any positive guards match the currently selected guard, but will not be
2268 pushed if any negative guards match the current guard. For example:
2275 Use the qguard command to set or print guards on patch, then use
2276 qselect to tell mq which guards to use. A patch will be pushed if
2277 it has no guards or any positive guards match the currently
2278 selected guard, but will not be pushed if any negative guards
2279 match the current guard. For example:
2269 2280
2270 2281 qguard foo.patch -stable (negative guard)
2271 2282 qguard bar.patch +stable (positive guard)
2272 2283 qselect stable
2273 2284
2274 This activates the "stable" guard. mq will skip foo.patch (because it has
2275 a negative match) but push bar.patch (because it has a positive match).
2285 This activates the "stable" guard. mq will skip foo.patch (because
2286 it has a negative match) but push bar.patch (because it has a
2287 positive match).
2276 2288
2277 With no arguments, prints the currently active guards. With one argument,
2278 sets the active guard.
2289 With no arguments, prints the currently active guards.
2290 With one argument, sets the active guard.
2279 2291
2280 Use -n/--none to deactivate guards (no other arguments needed). When no
2281 guards are active, patches with positive guards are skipped and patches
2282 with negative guards are pushed.
2292 Use -n/--none to deactivate guards (no other arguments needed).
2293 When no guards are active, patches with positive guards are
2294 skipped and patches with negative guards are pushed.
2283 2295
2284 qselect can change the guards on applied patches. It does not pop guarded
2285 patches by default. Use --pop to pop back to the last applied patch that
2286 is not guarded. Use --reapply (which implies --pop) to push back to the
2287 current patch afterwards, but skip guarded patches.
2296 qselect can change the guards on applied patches. It does not pop
2297 guarded patches by default. Use --pop to pop back to the last
2298 applied patch that is not guarded. Use --reapply (which implies
2299 --pop) to push back to the current patch afterwards, but skip
2300 guarded patches.
2288 2301
2289 Use -s/--series to print a list of all guards in the series file (no other
2290 arguments needed). Use -v for more information.
2291 '''
2302 Use -s/--series to print a list of all guards in the series file
2303 (no other arguments needed). Use -v for more information.'''
2292 2304
2293 2305 q = repo.mq
2294 2306 guards = q.active()
@@ -2363,16 +2375,18 b' def select(ui, repo, *args, **opts):'
2363 2375 def finish(ui, repo, *revrange, **opts):
2364 2376 """move applied patches into repository history
2365 2377
2366 Finishes the specified revisions (corresponding to applied patches) by
2367 moving them out of mq control into regular repository history.
2378 Finishes the specified revisions (corresponding to applied
2379 patches) by moving them out of mq control into regular repository
2380 history.
2368 2381
2369 Accepts a revision range or the -a/--applied option. If --applied is
2370 specified, all applied mq revisions are removed from mq control.
2371 Otherwise, the given revisions must be at the base of the stack of applied
2372 patches.
2382 Accepts a revision range or the -a/--applied option. If --applied
2383 is specified, all applied mq revisions are removed from mq
2384 control. Otherwise, the given revisions must be at the base of the
2385 stack of applied patches.
2373 2386
2374 This can be especially useful if your changes have been applied to an
2375 upstream repository, or if you are about to push your changes to upstream.
2387 This can be especially useful if your changes have been applied to
2388 an upstream repository, or if you are about to push your changes
2389 to upstream.
2376 2390 """
2377 2391 if not opts['applied'] and not revrange:
2378 2392 raise util.Abort(_('no revisions specified'))
General Comments 0
You need to be logged in to leave comments. Login now