more consistent "-r means [REV]"

Mathieu Clabaut mathieu.clabaut at gmail.com
Thu Apr 19 22:24:37 UTC 2007


+1 for such an uniformisation...
I still add -r when its unecessary or forgot one when its necessary...grmblll :)


On 4/19/07, Daniel Holth <dholth at fastmail.fm> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Rather than try to remember which commands use -r and which don't, a
> mistake I constantly make (made) and I've seen others make, here is a
> patch to accept -r in more places.
>
> I had to change "hg status" to accept "-e" as "show removed files". I
> think this is worthwhile for consistency, and because "revision" is a
> much more frequently needed concept than "removed (erased)"
>
> Comments?
>
> Thanks,
>
> Daniel Holth
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.3 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iD8DBQFGJ9vyVh4W2pVfoMsRAnxpAKCgmW7Kwenbi5b1kZD2enq6cbxVDgCgtZMB
> HvGea5weKtL/cboco5aqZ0g=
> =Z06R
> -----END PGP SIGNATURE-----
>
>
> diff --git a/mercurial/commands.py b/mercurial/commands.py
> --- a/mercurial/commands.py
> +++ b/mercurial/commands.py
> @@ -1819,7 +1819,7 @@ def manifest(ui, repo, rev=None):
>              ui.write("%3s " % (m.execf(f) and "755" or "644"))
>          ui.write("%s\n" % f)
>
> -def merge(ui, repo, node=None, force=None):
> +def merge(ui, repo, node=None, force=None, rev=None):
>      """merge working directory with another revision
>
>      Merge the contents of the current working directory and the
> @@ -1832,6 +1832,12 @@ def merge(ui, repo, node=None, force=Non
>      the other head is merged with by default.  Otherwise, an explicit
>      revision to merge with must be provided.
>      """
> +
> +    if rev and node:
> +        raise util.Abort(_("please specify just one revision"))
> +
> +    if not node:
> +        node = rev
>
>      if not node:
>          heads = repo.heads()
> @@ -2560,7 +2566,7 @@ def unbundle(ui, repo, fname, **opts):
>      modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname)
>      return postincoming(ui, repo, modheads, opts['update'])
>
> -def update(ui, repo, node=None, clean=False, date=None):
> +def update(ui, repo, node=None, clean=False, date=None, rev=None):
>      """update working directory
>
>      Update the working directory to the specified revision, or the
> @@ -2576,6 +2582,12 @@ def update(ui, repo, node=None, clean=Fa
>      By default, update will refuse to run if doing so would require
>      discarding local changes.
>      """
> +    if rev and node:
> +        raise util.Abort(_("please specify just one revision"))
> +
> +    if not node:
> +        node = rev
> +
>      if date:
>          if node:
>              raise util.Abort(_("you can't specify a revision and a date"))
> @@ -2684,6 +2696,7 @@ table = {
>            ('d', 'date', '', _('record datecode as commit date')),
>            ('', 'parent', '', _('parent to choose when backing out merge')),
>            ('u', 'user', '', _('record user as committer')),
> +          ('r', 'rev', '', _('revision to backout')),
>           ] + walkopts + commitopts,
>           _('hg backout [OPTION]... REV')),
>      "branch": (branch,
> @@ -2860,7 +2873,9 @@ table = {
>      "manifest": (manifest, [], _('hg manifest [REV]')),
>      "^merge":
>          (merge,
> -         [('f', 'force', None, _('force a merge with outstanding changes'))],
> +         [('f', 'force', None, _('force a merge with outstanding changes')),
> +          ('r', 'rev', '', _('revision to merge')),
> +             ],
>           _('hg merge [-f] [REV]')),
>      "outgoing|out": (outgoing,
>           [('M', 'no-merges', None, _('do not show merges')),
> @@ -2955,7 +2970,7 @@ table = {
>           [('A', 'all', None, _('show status of all files')),
>            ('m', 'modified', None, _('show only modified files')),
>            ('a', 'added', None, _('show only added files')),
> -          ('r', 'removed', None, _('show only removed files')),
> +          ('e', 'removed', None, _('show only removed files')),
>            ('d', 'deleted', None, _('show only deleted (but tracked) files')),
>            ('c', 'clean', None, _('show only files without changes')),
>            ('u', 'unknown', None, _('show only unknown (not tracked) files')),
> @@ -2964,7 +2979,7 @@ table = {
>            ('C', 'copies', None, _('show source of copied files')),
>            ('0', 'print0', None,
>             _('end filenames with NUL, for use with xargs')),
> -          ('', 'rev', [], _('show difference from revision')),
> +          ('r', 'rev', [], _('show difference from revision')),
>           ] + walkopts,
>           _('hg status [OPTION]... [FILE]...')),
>      "tag":
> @@ -2992,7 +3007,8 @@ table = {
>      "^update|up|checkout|co":
>          (update,
>           [('C', 'clean', None, _('overwrite locally modified files')),
> -          ('d', 'date', '', _('tipmost revision matching date'))],
> +          ('d', 'date', '', _('tipmost revision matching date')),
> +          ('r', 'rev', '', _('desired revision'))],
>           _('hg update [-C] [-d DATE] [REV]')),
>      "verify": (verify, [], _('hg verify')),
>      "version": (version_, [], _('hg version')),
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel
>
>



More information about the Mercurial-devel mailing list