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