Mercurial > hg
changeset 9067:2ebac2bf7ad5
mq: wrapped docstrings at 78 characters
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Tue, 07 Jul 2009 23:54:42 +0200 |
parents | 11b111e9acd3 |
children | 27a41250a9ce |
files | hgext/mq.py tests/test-mq.out |
diffstat | 2 files changed, 112 insertions(+), 126 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/mq.py Tue Jul 07 23:54:42 2009 +0200 +++ b/hgext/mq.py Tue Jul 07 23:54:42 2009 +0200 @@ -8,11 +8,11 @@ '''manage a stack of patches This extension lets you work with a stack of patches in a Mercurial -repository. It manages two stacks of patches - all known patches, and -applied patches (subset of known patches). +repository. It manages two stacks of patches - all known patches, and applied +patches (subset of known patches). -Known patches are represented as patch files in the .hg/patches -directory. Applied patches are both patch files and changesets. +Known patches are represented as patch files in the .hg/patches directory. +Applied patches are both patch files and changesets. Common tasks (use "hg help command" for more details): @@ -1681,29 +1681,26 @@ def qimport(ui, repo, *filename, **opts): """import a patch - The patch is inserted into the series after the last applied - patch. If no patches have been applied, qimport prepends the patch - to the series. + The patch is inserted into the series after the last applied patch. If no + patches have been applied, qimport prepends the patch to the series. - The patch will have the same name as its source file unless you - give it a new one with -n/--name. + The patch will have the same name as its source file unless you give it a + new one with -n/--name. - You can register an existing patch inside the patch directory with - the -e/--existing flag. + You can register an existing patch inside the patch directory with the + -e/--existing flag. - With -f/--force, an existing patch of the same name will be - overwritten. + With -f/--force, an existing patch of the same name will be overwritten. - An existing changeset may be placed under mq control with -r/--rev - (e.g. qimport --rev tip -n patch will place tip under mq control). - With -g/--git, patches imported with --rev will use the git diff - format. See the diffs help topic for information on why this is - important for preserving rename/copy information and permission - changes. + An existing changeset may be placed under mq control with -r/--rev (e.g. + qimport --rev tip -n patch will place tip under mq control). With + -g/--git, patches imported with --rev will use the git diff format. See + the diffs help topic for information on why this is important for + preserving rename/copy information and permission changes. - To import a patch from standard input, pass - as the patch file. - When importing from standard input, a patch name must be specified - using the --name flag. + To import a patch from standard input, pass - as the patch file. When + importing from standard input, a patch name must be specified using the + --name flag. """ q = repo.mq q.qimport(repo, filename, patchname=opts['name'], @@ -1718,11 +1715,12 @@ def init(ui, repo, **opts): """init a new queue repository - The queue repository is unversioned by default. If - -c/--create-repo is specified, qinit will create a separate nested - repository for patches (qinit -c may also be run later to convert - an unversioned patch repository into a versioned one). You can use - qcommit to commit changes to this queue repository.""" + The queue repository is unversioned by default. If -c/--create-repo is + specified, qinit will create a separate nested repository for patches + (qinit -c may also be run later to convert an unversioned patch repository + into a versioned one). You can use qcommit to commit changes to this queue + repository. + """ q = repo.mq r = q.init(repo, create=opts['create_repo']) q.save_dirty() @@ -1744,17 +1742,16 @@ def clone(ui, source, dest=None, **opts): '''clone main and patch repository at same time - If source is local, destination will have no patches applied. If - source is remote, this command can not check if patches are - applied in source, so cannot guarantee that patches are not - applied in destination. If you clone remote repository, be sure - before that it has no patches applied. + If source is local, destination will have no patches applied. If source is + remote, this command can not check if patches are applied in source, so + cannot guarantee that patches are not applied in destination. If you clone + remote repository, be sure before that it has no patches applied. - Source patch repository is looked for in <src>/.hg/patches by - default. Use -p <url> to change. + Source patch repository is looked for in <src>/.hg/patches by default. Use + -p <url> to change. - The patch directory must be a nested Mercurial repository, as - would be created by qinit -c. + The patch directory must be a nested Mercurial repository, as would be + created by qinit -c. ''' def patchdir(repo): url = repo.url() @@ -1860,26 +1857,24 @@ def new(ui, repo, patch, *args, **opts): """create a new patch - qnew creates a new patch on top of the currently-applied patch (if - any). It will refuse to run if there are any outstanding changes - unless -f/--force is specified, in which case the patch will be - initialized with them. You may also use -I/--include, - -X/--exclude, and/or a list of files after the patch name to add - only changes to matching files to the new patch, leaving the rest - as uncommitted modifications. + qnew creates a new patch on top of the currently-applied patch (if any). + It will refuse to run if there are any outstanding changes unless + -f/--force is specified, in which case the patch will be initialized with + them. You may also use -I/--include, -X/--exclude, and/or a list of files + after the patch name to add only changes to matching files to the new + patch, leaving the rest as uncommitted modifications. - -u/--user and -d/--date can be used to set the (given) user and - date, respectively. -U/--currentuser and -D/--currentdate set user - to current user and date to current date. + -u/--user and -d/--date can be used to set the (given) user and date, + respectively. -U/--currentuser and -D/--currentdate set user to current + user and date to current date. - -e/--edit, -m/--message or -l/--logfile set the patch header as - well as the commit message. If none is specified, the header is - empty and the commit message is '[mq]: PATCH'. + -e/--edit, -m/--message or -l/--logfile set the patch header as well as + the commit message. If none is specified, the header is empty and the + commit message is '[mq]: PATCH'. - Use the -g/--git option to keep the patch in the git extended diff - format. Read the diffs help topic for more information on why this - is important for preserving permission changes and copy/rename - information. + Use the -g/--git option to keep the patch in the git extended diff format. + Read the diffs help topic for more information on why this is important + for preserving permission changes and copy/rename information. """ msg = cmdutil.logmessage(opts) def getmsg(): return ui.edit(msg, ui.username()) @@ -1897,17 +1892,16 @@ def refresh(ui, repo, *pats, **opts): """update the current patch - If any file patterns are provided, the refreshed patch will - contain only the modifications that match those patterns; the - remaining modifications will remain in the working directory. + If any file patterns are provided, the refreshed patch will contain only + the modifications that match those patterns; the remaining modifications + will remain in the working directory. - If -s/--short is specified, files currently included in the patch - will be refreshed just like matched files and remain in the patch. + If -s/--short is specified, files currently included in the patch will be + refreshed just like matched files and remain in the patch. - hg add/remove/copy/rename work as usual, though you might want to - use git-style patches (-g/--git or [diff] git=1) to track copies - and renames. See the diffs help topic for more information on the - git diff format. + hg add/remove/copy/rename work as usual, though you might want to use + git-style patches (-g/--git or [diff] git=1) to track copies and renames. + See the diffs help topic for more information on the git diff format. """ q = repo.mq message = cmdutil.logmessage(opts) @@ -1928,15 +1922,13 @@ def diff(ui, repo, *pats, **opts): """diff of the current patch and subsequent modifications - Shows a diff which includes the current patch as well as any - changes which have been made in the working directory since the - last refresh (thus showing what the current patch would become - after a qrefresh). + Shows a diff which includes the current patch as well as any changes which + have been made in the working directory since the last refresh (thus + showing what the current patch would become after a qrefresh). - Use 'hg diff' if you only want to see the changes made since the - last qrefresh, or 'hg export qtip' if you want to see changes made - by the current patch without including changes made since the - qrefresh. + Use 'hg diff' if you only want to see the changes made since the last + qrefresh, or 'hg export qtip' if you want to see changes made by the + current patch without including changes made since the qrefresh. """ repo.mq.diff(repo, pats, opts) return 0 @@ -1944,15 +1936,15 @@ def fold(ui, repo, *files, **opts): """fold the named patches into the current patch - Patches must not yet be applied. Each patch will be successively - applied to the current patch in the order given. If all the - patches apply successfully, the current patch will be refreshed - with the new cumulative patch, and the folded patches will be - deleted. With -k/--keep, the folded patch files will not be - removed afterwards. + Patches must not yet be applied. Each patch will be successively applied + to the current patch in the order given. If all the patches apply + successfully, the current patch will be refreshed with the new cumulative + patch, and the folded patches will be deleted. With -k/--keep, the folded + patch files will not be removed afterwards. - The header for each folded patch will be concatenated with the - current patch header, separated by a line of '* * *'.""" + The header for each folded patch will be concatenated with the current + patch header, separated by a line of '* * *'. + """ q = repo.mq @@ -2018,14 +2010,13 @@ def guard(ui, repo, *args, **opts): '''set or print guards for a patch - Guards control whether a patch can be pushed. A patch with no - guards is always pushed. A patch with a positive guard ("+foo") is - pushed only if the qselect command has activated it. A patch with - a negative guard ("-foo") is never pushed if the qselect command - has activated it. + Guards control whether a patch can be pushed. A patch with no guards is + always pushed. A patch with a positive guard ("+foo") is pushed only if + the qselect command has activated it. A patch with a negative guard + ("-foo") is never pushed if the qselect command has activated it. - With no arguments, print the currently active guards. - With arguments, set guards for the named patch. + With no arguments, print the currently active guards. With arguments, set + guards for the named patch. NOTE: Specifying negative guards now requires '--'. To set guards on another patch: @@ -2102,8 +2093,8 @@ def push(ui, repo, patch=None, **opts): """push the next patch onto the stack - When -f/--force is applied, all local changes in patched files - will be lost. + When -f/--force is applied, all local changes in patched files will be + lost. """ q = repo.mq mergeq = None @@ -2125,9 +2116,9 @@ def pop(ui, repo, patch=None, **opts): """pop the current patch off the stack - By default, pops off the top of the patch stack. If given a patch - name, keeps popping off patches until the named patch is at the - top of the stack. + By default, pops off the top of the patch stack. If given a patch name, + keeps popping off patches until the named patch is at the top of the + stack. """ localupdate = True if opts['name']: @@ -2244,8 +2235,7 @@ """strip a revision and all its descendants from the repository If one of the working directory's parent revisions is stripped, the - working directory will be updated to the parent of the stripped - revision. + working directory will be updated to the parent of the stripped revision. """ backup = 'all' if opts['backup']: @@ -2270,35 +2260,33 @@ def select(ui, repo, *args, **opts): '''set or print guarded patches to push - Use the qguard command to set or print guards on patch, then use - qselect to tell mq which guards to use. A patch will be pushed if - it has no guards or any positive guards match the currently - selected guard, but will not be pushed if any negative guards - match the current guard. For example: + Use the qguard command to set or print guards on patch, then use qselect + to tell mq which guards to use. A patch will be pushed if it has no guards + or any positive guards match the currently selected guard, but will not be + pushed if any negative guards match the current guard. For example: qguard foo.patch -stable (negative guard) qguard bar.patch +stable (positive guard) qselect stable - This activates the "stable" guard. mq will skip foo.patch (because - it has a negative match) but push bar.patch (because it has a - positive match). + This activates the "stable" guard. mq will skip foo.patch (because it has + a negative match) but push bar.patch (because it has a positive match). - With no arguments, prints the currently active guards. - With one argument, sets the active guard. + With no arguments, prints the currently active guards. With one argument, + sets the active guard. - Use -n/--none to deactivate guards (no other arguments needed). - When no guards are active, patches with positive guards are - skipped and patches with negative guards are pushed. + Use -n/--none to deactivate guards (no other arguments needed). When no + guards are active, patches with positive guards are skipped and patches + with negative guards are pushed. - qselect can change the guards on applied patches. It does not pop - guarded patches by default. Use --pop to pop back to the last - applied patch that is not guarded. Use --reapply (which implies - --pop) to push back to the current patch afterwards, but skip - guarded patches. + qselect can change the guards on applied patches. It does not pop guarded + patches by default. Use --pop to pop back to the last applied patch that + is not guarded. Use --reapply (which implies --pop) to push back to the + current patch afterwards, but skip guarded patches. - Use -s/--series to print a list of all guards in the series file - (no other arguments needed). Use -v for more information.''' + Use -s/--series to print a list of all guards in the series file (no other + arguments needed). Use -v for more information. + ''' q = repo.mq guards = q.active() @@ -2373,18 +2361,16 @@ def finish(ui, repo, *revrange, **opts): """move applied patches into repository history - Finishes the specified revisions (corresponding to applied - patches) by moving them out of mq control into regular repository - history. + Finishes the specified revisions (corresponding to applied patches) by + moving them out of mq control into regular repository history. - Accepts a revision range or the -a/--applied option. If --applied - is specified, all applied mq revisions are removed from mq - control. Otherwise, the given revisions must be at the base of the - stack of applied patches. + Accepts a revision range or the -a/--applied option. If --applied is + specified, all applied mq revisions are removed from mq control. + Otherwise, the given revisions must be at the base of the stack of applied + patches. - This can be especially useful if your changes have been applied to - an upstream repository, or if you are about to push your changes - to upstream. + This can be especially useful if your changes have been applied to an + upstream repository, or if you are about to push your changes to upstream. """ if not opts['applied'] and not revrange: raise util.Abort(_('no revisions specified'))
--- a/tests/test-mq.out Tue Jul 07 23:54:42 2009 +0200 +++ b/tests/test-mq.out Tue Jul 07 23:54:42 2009 +0200 @@ -2,11 +2,11 @@ mq extension - manage a stack of patches This extension lets you work with a stack of patches in a Mercurial -repository. It manages two stacks of patches - all known patches, and -applied patches (subset of known patches). +repository. It manages two stacks of patches - all known patches, and applied +patches (subset of known patches). -Known patches are represented as patch files in the .hg/patches -directory. Applied patches are both patch files and changesets. +Known patches are represented as patch files in the .hg/patches directory. +Applied patches are both patch files and changesets. Common tasks (use "hg help command" for more details):