zsh-workers
 help / color / mirror / code / Atom feed
* mercurial completion patch
@ 2010-05-19 14:16 Sebastian Tramp
  2010-05-20 16:23 ` Richard Hartmann
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastian Tramp @ 2010-05-19 14:16 UTC (permalink / raw)
  To: zsh-workers


Hi all,

I've updated the mercurial completion file _hg to reflect that most 
commands accept not only tags and revision hashs as revision parameter but 
also branch names of named branches (hg branches).

I think this patch is important for all people who do use named branches 
in their projects.

So my question is, what is the best way to contribute this enhancement?

best regards

S.Tramp

-- 
Sebastian Tramp - Department of Computer Science; University of Leipzig
Tel/Fax: +49 341 97 323-66/-29 http://bis.uni-leipzig.de/SebastianTramp


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: mercurial completion patch
  2010-05-19 14:16 mercurial completion patch Sebastian Tramp
@ 2010-05-20 16:23 ` Richard Hartmann
  2010-05-24 17:42   ` [PATCH] add: named branches and special revisions for multiple commands Sebastian Tramp
  0 siblings, 1 reply; 4+ messages in thread
From: Richard Hartmann @ 2010-05-20 16:23 UTC (permalink / raw)
  To: Sebastian Tramp; +Cc: zsh-workers

On Wed, May 19, 2010 at 16:16, Sebastian Tramp
<tramp@informatik.uni-leipzig.de> wrote:

> So my question is, what is the best way to contribute this enhancement?

Send it to this list.


Richard


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH] add: named branches and special revisions for multiple commands
  2010-05-20 16:23 ` Richard Hartmann
@ 2010-05-24 17:42   ` Sebastian Tramp
  2010-05-25 19:50     ` Richard Hartmann
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastian Tramp @ 2010-05-24 17:42 UTC (permalink / raw)
  To: Richard Hartmann; +Cc: zsh-workers

quote Richard Hartmann (20.5.2010):

This patch introduces named branches, tags and local head ids as 
speciarevision for multiple commands of mercurial ...

best regards

S.Tramp


---
  Completion/Unix/Command/_hg |   54 ++++++++++++++++++++++++++++--------------
  1 files changed, 36 insertions(+), 18 deletions(-)

diff --git a/Completion/Unix/Command/_hg b/Completion/Unix/Command/_hg
index aeb64f6..850215b 100644
--- a/Completion/Unix/Command/_hg
+++ b/Completion/Unix/Command/_hg
@@ -15,6 +15,7 @@
  #
  # Copyright (C) 2005, 2006 Steve Borho <steve@borho.org>
  # Copyright (C) 2006-9 Brendan Cully <brendan@kublai.com>
+# Copyright (C) 2010 Sebastian Tramp <mail@sebastian.tramp.name> (special revisions / named branches)
  #
  # Permission is hereby granted, without written agreement and without
  # licence or royalty fees, to use, copy, modify, and distribute this
@@ -173,8 +174,20 @@ _hg_tags() {
    (( $#tags )) && _describe -t tags 'tags' tags
  }

-# likely merge candidates
-_hg_mergerevs() {
+# named branches as described in http://mercurial.selenic.com/wiki/NamedBranches
+_hg_branches() {
+  typeset -a branches
+  local branch rev
+
+  _hg_cmd branches 2> /dev/null | cut -f 1 -d ' ' | while read branch
+  do
+    branches+=(${branch/ #    [0-9]#:*})
+  done
+  (( $#branches )) && _describe -t branches 'named branches' branches
+}
+
+# current heads of the repository
+_hg_heads() {
    typeset -a heads
    local myrev

@@ -186,6 +199,11 @@ _hg_mergerevs() {
    (( $#heads )) && _describe -t heads 'heads' heads
  }

+# this is an alternative of named branches, tags and heads
+_hg_specialrevisions() {
+  _alternative 'branches:named branches:_hg_branches' 'tags:tags:_hg_tags' 'heads:heads:_hg_heads'
+}
+
  _hg_files() {
    if [[ -n "$_hg_root" ]]
    then
@@ -394,7 +412,7 @@ _hg_cmd_addremove() {

  _hg_cmd_annotate() {
    _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
-  '(--rev -r)'{-r+,--rev}'[annotate the specified revision]:revision:_hg_tags' \
+  '(--rev -r)'{-r+,--rev}'[annotate the specified revision]:revision:_hg_specialrevisions' \
    '(--follow -f)'{-f,--follow}'[follow file copies and renames]' \
    '(--text -a)'{-a,--text}'[treat all files as text]' \
    '(--user -u)'{-u,--user}'[list the author]' \
@@ -408,7 +426,7 @@ _hg_cmd_archive() {
    _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
    '--no-decode[do not pass files through decoders]' \
    '(--prefix -p)'{-p+,--prefix}'[directory prefix for files in archive]:' \
-  '(--rev -r)'{-r+,--rev}'[revision to distribute]:revision:_hg_tags' \
+  '(--rev -r)'{-r+,--rev}'[revision to distribute]:revision:_hg_specialrevisions' \
    '(--type -t)'{-t+,--type}'[type of distribution to create]:archive type:(files tar tbz2 tgz uzip zip)' \
    '*:destination:_files'
  }
@@ -456,7 +474,7 @@ _hg_cmd_bundle() {
  _hg_cmd_cat() {
    _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
    '(--output -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
-  '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_tags' \
+  '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_specialrevisions' \
    '*:file:_hg_files'
  }

@@ -511,7 +529,7 @@ _hg_cmd_export() {
    _arguments -s -w : $_hg_global_opts $_hg_diff_opts \
    '(--outout -o)'{-o+,--output}'[print output to file with formatted name]:filespec:' \
    '--switch-parent[diff against the second parent]' \
-  '*:revision:_hg_tags'
+  '*:revision:_hg_specialrevisions'
  }

  _hg_cmd_grep() {
@@ -540,7 +558,7 @@ _hg_cmd_help() {

  _hg_cmd_identify() {
    _arguments -s -w : $_hg_global_opts \
-  '(--rev -r)'{-r+,--rev}'[identify the specified rev]:revision:_hg_tags' \
+  '(--rev -r)'{-r+,--rev}'[identify the specified rev]:revision:_hg_specialrevisions' \
    '(--num -n)'{-n+,--num}'[show local revision number]' \
    '(--id -i)'{-i+,--id}'[show global revision id]' \
    '(--branch -b)'{-b+,--branch}'[show branch]' \
@@ -560,7 +578,7 @@ _hg_cmd_incoming() {
    '(--no-merges -M)'{-M,--no-merges}'[do not show merge revisions]' \
    '(--force -f)'{-f,--force}'[run even when the remote repository is unrelated]' \
    '(--patch -p)'{-p,--patch}'[show patch]' \
-  '(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]:revision:_hg_tags' \
+  '(--rev -r)'{-r+,--rev}'[a specific revision up to which you would like to pull]:revision:_hg_specialrevisions' \
    '(--newest-first -n)'{-n,--newest-first}'[show newest record first]' \
    '--bundle[file to store the bundles into]:bundle file:_files' \
    ':source:_hg_remote'
@@ -573,7 +591,7 @@ _hg_cmd_init() {

  _hg_cmd_locate() {
    _arguments -s -w : $_hg_global_opts $_hg_pat_opts \
-  '(--rev -r)'{-r+,--rev}'[search repository as it stood at revision]:revision:_hg_tags' \
+  '(--rev -r)'{-r+,--rev}'[search repository as it stood at revision]:revision:_hg_specialrevisions' \
    '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
    '(--fullpath -f)'{-f,--fullpath}'[print complete paths]' \
    '*:search pattern:_hg_files'
@@ -590,21 +608,21 @@ _hg_cmd_log() {
    '(--no-merges -M)'{-M,--no-merges}'[do not show merges]' \
    '(--only-merges -m)'{-m,--only-merges}'[show only merges]' \
    '(--patch -p)'{-p,--patch}'[show patch]' \
-  '(--prune -P)'{-P+,--prune}'[do not display revision or any of its ancestors]:revision:_hg_tags' \
+  '(--prune -P)'{-P+,--prune}'[do not display revision or any of its ancestors]:revision:_hg_specialrevisions' \
    '*:files:_hg_files'
  }

  _hg_cmd_manifest() {
    _arguments -s -w : $_hg_global_opts \
-  ':revision:_hg_tags'
+  ':revision:_hg_specialrevisions'
  }

  _hg_cmd_merge() {
    _arguments -s -w : $_hg_global_opts \
    '(--force -f)'{-f,--force}'[force a merge with outstanding changes]' \
-  '(--rev -r 1)'{-r,--rev}'[revision to merge]:revision:_hg_mergerevs' \
+  '(--rev -r 1)'{-r,--rev}'[revision to merge]:revision:_hg_specialrevisions' \
    '(--preview -P)'{-P,--preview}'[review revisions to merge (no merge is performed)]' \
-  ':revision:_hg_mergerevs'
+  ':revision:_hg_specialrevisions'
  }

  _hg_cmd_outgoing() {
@@ -619,7 +637,7 @@ _hg_cmd_outgoing() {

  _hg_cmd_parents() {
    _arguments -s -w : $_hg_global_opts $_hg_style_opts \
-  '(--rev -r)'{-r+,--rev}'[show parents of the specified rev]:revision:_hg_tags' \
+  '(--rev -r)'{-r+,--rev}'[show parents of the specified rev]:revision:_hg_specialrevisions' \
    ':last modified file:_hg_files'
  }

@@ -639,7 +657,7 @@ _hg_cmd_pull() {
  _hg_cmd_push() {
    _arguments -s -w : $_hg_global_opts $_hg_remote_opts \
    '(--force -f)'{-f,--force}'[force push]' \
-  '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]:revision:_hg_tags' \
+  '(--rev -r)'{-r+,--rev}'[a specific revision you would like to push]:revision:_hg_specialrevisions' \
    ':destination:_hg_remote'
  }

@@ -730,7 +748,7 @@ _hg_cmd_status() {
    '(--no-status -n)'{-n,--no-status}'[hide status prefix]' \
    '(--copies -C)'{-C,--copies}'[show source of copied files]' \
    '(--print0 -0)'{-0,--print0}'[end filenames with NUL, for use with xargs]' \
-  '--rev[show difference from revision]:revision:_hg_tags' \
+  '--rev[show difference from revision]:revision:_hg_specialrevisions' \
    '*:files:_files'
  }

@@ -758,8 +776,8 @@ _hg_cmd_unbundle() {
  _hg_cmd_update() {
    _arguments -s -w : $_hg_global_opts \
    '(--clean -C)'{-C,--clean}'[overwrite locally modified files]' \
-  '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_tags' \
-  ':revision:_hg_tags'
+  '(--rev -r)'{-r+,--rev}'[revision]:revision:_hg_specialrevisions' \
+  ':revision:_hg_specialrevisions'
  }

  # HGK
-- 
1.7.0.4


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] add: named branches and special revisions for multiple  commands
  2010-05-24 17:42   ` [PATCH] add: named branches and special revisions for multiple commands Sebastian Tramp
@ 2010-05-25 19:50     ` Richard Hartmann
  0 siblings, 0 replies; 4+ messages in thread
From: Richard Hartmann @ 2010-05-25 19:50 UTC (permalink / raw)
  To: Sebastian Tramp; +Cc: zsh-workers

On Mon, May 24, 2010 at 19:42, Sebastian Tramp
<tramp@informatik.uni-leipzig.de> wrote:
> quote Richard Hartmann (20.5.2010):

"send it to this list" :p


> This patch introduces named branches, tags and local head ids as
> speciarevision for multiple commands of mercurial ...

Thanks. People who use hg should report back if it works for them
and then it should be merged.


Richard


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-05-25 19:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-05-19 14:16 mercurial completion patch Sebastian Tramp
2010-05-20 16:23 ` Richard Hartmann
2010-05-24 17:42   ` [PATCH] add: named branches and special revisions for multiple commands Sebastian Tramp
2010-05-25 19:50     ` Richard Hartmann

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).