# HG changeset patch # User Benoit Boissinot # Date 1162296232 -3600 # Node ID 5f08389bcf064190f680ad638114dc3c3f1da063 # Parent 9bfb3c049b2aaa85c013262db3907179902b7560# Parent 1c9b6f1237e007eb7f39774ec0c1f4335271e493 merge with crew diff -r 9bfb3c049b2a -r 5f08389bcf06 contrib/zsh_completion --- a/contrib/zsh_completion Tue Oct 31 13:03:23 2006 +0100 +++ b/contrib/zsh_completion Tue Oct 31 13:03:52 2006 +0100 @@ -140,13 +140,19 @@ _hg_unknown() { typeset -a status_files _hg_status u - (( $#status_files )) && _describe -t files 'unknown files' status_files + _wanted files expl 'unknown files' _multi_parts / status_files } _hg_missing() { typeset -a status_files _hg_status d - (( $#status_files )) && _describe -t files 'missing files' status_files + _wanted files expl 'missing files' _multi_parts / status_files +} + +_hg_modified() { + typeset -a status_files + _hg_status m + _wanted files expl 'modified files' _multi_parts / status_files } _hg_addremove() { @@ -303,13 +309,24 @@ } _hg_cmd_diff() { + typeset -A opt_args _arguments -s -w : $_hg_global_opts $_hg_pat_opts $_hg_diff_opts \ '*'{-r,--rev}'+[revision]:revision:_hg_revrange' \ '(--show-function -p)'{-p,--show-function}'[show which function each change is in]' \ '(--ignore-all-space -w)'{-w,--ignore-all-space}'[ignore white space when comparing lines]' \ '(--ignore-space-change -b)'{-b,--ignore-space-change}'[ignore changes in the amount of white space]' \ '(--ignore-blank-lines -B)'{-B,--ignore-blank-lines}'[ignore changes whose lines are all blank]' \ - '*:file:_files -W $(_hg_cmd root)' + '*:file:->diff_files' + + if [[ $state == 'diff_files' ]] + then + if [[ -n $opt_args[-r] ]] + then + _files -W $(_hg_cmd root) + else + _hg_modified + fi + fi } _hg_cmd_export() { @@ -448,7 +465,19 @@ '(--all -a :)'{-a,--all}'[revert all changes when no arguments given]' \ '(--rev -r)'{-r+,--rev}'[revision to revert to]:revision:_hg_tags' \ '--no-backup[do not save backup copies of files]' \ - '*:file:_files -W $(_hg_cmd root)' + '*:file:->diff_files' + + if [[ $state == 'diff_files' ]] + then + if [[ -n $opt_args[-r] ]] + then + _files -W $(_hg_cmd root) + else + typeset -a status_files + _hg_status mard + _wanted files expl 'modified, added, removed or deleted file' _multi_parts / status_files + fi + fi } _hg_cmd_serve() { diff -r 9bfb3c049b2a -r 5f08389bcf06 mercurial/patch.py --- a/mercurial/patch.py Tue Oct 31 13:03:23 2006 +0100 +++ b/mercurial/patch.py Tue Oct 31 13:03:52 2006 +0100 @@ -369,6 +369,9 @@ if gp and gp.mode: x = gp.mode & 0100 != 0 dst = os.path.join(repo.root, gp.path) + # patch won't create empty files + if ctype == 'ADD' and not os.path.exists(dst): + repo.wwrite(gp.path, '') util.set_exec(dst, x) cmdutil.addremove(repo, cfiles, wlock=wlock) files = patches.keys() diff -r 9bfb3c049b2a -r 5f08389bcf06 tests/test-git-import --- a/tests/test-git-import Tue Oct 31 13:03:23 2006 +0100 +++ b/tests/test-git-import Tue Oct 31 13:03:52 2006 +0100 @@ -14,6 +14,13 @@ +a EOF +echo % new empty file +hg import -mempty - <