D4426: zsh_completion: use revsets to exclude this rev from suggestions to hg merge

spectral (Kyle Lippincott) phabricator at mercurial-scm.org
Fri Aug 31 18:34:21 EDT 2018


spectral added a comment.


  Would it make sense to combine this into one hg invocation?  I think it wouldn't be that hard (hmm, not as trivial as I thought, but.. not the worst thing ever? :))
  
    allheads=(${(f)"$(_hg_cmd log -r 'sort(head(), -rev)' --template '{ifcontains(rev, revset(\".\"), \"T\", \"F\")}:{rev}:{branch}\n')"})
    
    # Extract current revision from allheads, remove "[TF]:" prefix from each item
    selfentry=(${${allheads:#F*}/#T:/})
    heads=(${${allheads:#T*}/#F:/})
    
    # Remove "{rev}:" prefix from each item in heads to get just branch names
    branches=(${(S)heads/#*:/})
    
    # Remove branches that match the one we're currently on
    selfbranch=(${(S)selfentry/#*:/})
    branches=(${branches:#$selfbranch})

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4426

To: av6, #hg-reviewers
Cc: spectral, mjpieters, mercurial-devel


More information about the Mercurial-devel mailing list