Commits

ZyX_I committed 5f912a5

Made :AuMove leftpattern always use paths relative to repository, added :AuMove repo
Fixed more gwine tests: now only 5 are not working (annotate-buffers, annotatemaps, logmaps, record, statmaps)

  • Participants
  • Parent commits 963c580

Comments (0)

Files changed (7)

File doc/aurum.txt

     [no]showrenames
                 Flag. Determines whether renames should be shown.
 
-AuMove [copy] [rightrepl] [leftpattern] [pretend] [args ...]         *:AuMove*
+                                                                     *:AuMove*
+AuMove [copy] [rightrepl] [leftpattern] [pretend] [repo {repo}] [args ...]
     Move (with `copy' option: copy) files. Depending on number and type of 
     arguments it can be one of the following:
     - No arguments: move current file to current directory.
           AuMove leftpattern \\v^(.*)\\.txt$ \\1.doc
             file.txt     -> file.doc
             dir/file.txt -> dir/file.doc
-<   - Two arguments containing at least one star or question mark which both 
+<     Note that this is the only case when paths are assumed to be relative to 
+           repository root. In any other cases they are assumed to be relative 
+           to current directory.
+    - Two arguments containing at least one star or question mark which both 
       have just the same number of unescaped stars and/or question marks 
       arranged in the same order. In this case it acts like `zmv -W': parts of 
       filename matching wildcards are captured (note vim allows only up to 

File plugin/aurum.vim

 " :AuM pat+ dir — move given file(s) to given directory
 " :AuM pat+     — move given file(s) to current directory
 function s:movefunc.function(bang, opts, ...)
-    if a:0
+    if a:0 && !get(a:opts, 'leftpattern', 0) && a:opts.repo is# ':'
         let repo=s:_r.repo.get(a:1)
     else
-        let repo=s:_r.repo.get(':')
+        let repo=s:_r.repo.get(a:opts.repo)
     endif
     call s:_r.cmdutils.checkrepo(repo)
     let allfiles=s:F.getexsttrckdfiles(repo)
         let patterns=map(a:000[:-2], 's:_r.cmdutils.globtopat('.
                     \                'repo.functions.reltorepo(repo,v:val), 1)')
         let moves={}
-        let repl=repo.functions.reltorepo(repo, a:000[-1])
+        let repl=a:000[-1]
         for pattern in patterns
             for file in filter(copy(allfiles), 'v:val=~#pattern && '.
                         \                      '!has_key(moves, v:val)')
-                let moves[file]=substitute(file, pattern, repl, '')
+                let moves[file]=repo.functions.reltorepo(repo,
+                            \               substitute(file, pattern, repl, ''))
             endfor
         endfor
     elseif a:0>1 && get(a:opts, 'leftpattern', 0)
         let moves={}
-        let repl=repo.functions.reltorepo(repo, a:000[-1])
-        for pattern in map(a:000[:-2], 'repo.functions.reltorepo(repo, v:val)')
+        let repl=a:000[-1]
+        for pattern in a:000[:-2]
             for file in filter(copy(allfiles), 'v:val=~#pattern && '.
                         \                      '!has_key(moves, v:val)')
                 let moves[file]=substitute(file, pattern, repl, '')
                 \substitute(a:2, '\v%(^|$|\\.|[^*])[^*?]*', '-', 'g')
         let pattern=s:_r.cmdutils.globtopat(repo.functions.reltorepo(repo, a:1),
                     \                       1)
-        let repl=split(repo.functions.reltorepo(repo, a:2), '\V\(**\?\|?\)', 1)
+        let repl=split(a:2, '\V\(**\?\|?\)', 1)
         let moves={}
         for [file, match] in filter(map(copy(allfiles),
                     \                   '[v:val, matchlist(v:val, pattern)]'),
                 let target .= s . get(match, i, '')
                 let i+=1
             endfor
-            let moves[file]=target
+            let moves[file]=repo.functions.reltorepo(repo, target)
         endfor
     elseif a:0==2 && !isdirectory(a:2) && filewritable(a:1)
         let fst=a:1
     endif
 endfunction
 let s:movefunc['@FWC']=['-onlystrings _ '.
-            \           '{ ?!copy ?!rightrepl ?!leftpattern ?!pretend } '.
+            \           '{  repo '.s:_r.cmdutils.nogetrepoarg.
+            \           ' ?!copy ?!rightrepl ?!leftpattern ?!pretend } '.
             \           '+ type ""', 'filter']
 call add(s:movecomp,
             \substitute(substitute(s:movefunc['@FWC'][0],

File plugin/aurum/vimdiff.vim

             \  'Exit': {'lhs': 'X', 'rhs': s:F.exit},
         \}, {'mode': 'n', 'silent': 1, 'dontmap': 1, 'leader': ',',})
 "▶1 vimdfunc
+" TODO AuVimDiff full (opens multiple splits in different tabs)
 function s:vimdfunc.function(opts, ...)
     "▶2 repo and revisions
     let [hasbuf, repo, rev, file]=s:_r.cmdutils.getrrf(a:opts, 'nodfile', 0)

File test/move.in

 :execute 'AuMove rightrepl '.g:curtest.'repo/**.lst '.g:curtest.'repo/test/\\1.mkv'
 :CS
 :W{{{1 :AuM leftpattern vimpat repl
-:execute 'AuMove leftpattern '.g:curtest.'repo/\\v^([nh].*)\\.lst$ '.g:curtest.'repo/test/\\1.mkv'
+:execute 'AuMove repo '.g:curtest.'repo leftpattern \\v^([nh].*)\\.lst$ test/\\1.mkv'
 :CS
 :W{{{1 :AuM pretend pat pat
 :W>>> Redirecting command output

File test/parjobssetup.zsh

+#!/bin/zsh
+# Omit errors caused by tempnames clash
+typeset -x MAXJOBS=1
             execute 'silent cd' fnameescape(olddir)
         endif
         if a:write
-            execute 'silent write! >> '.fnameescape(s:outfile)
+            execute 'silent write! ++ff=unix >> '.fnameescape(s:outfile)
         endif
     endtry
 endfunction

File test/wine/diff.ok

 {{{1
-diff -r df55ab32bcfa addeddef
---- /dev/null
-+++ b/addeddef
-@@ -0,0 +1,1 @@
-+Def
-diff -r df55ab32bcfa hglines2.lst
---- a/hglines2.lst
-+++ /dev/null
-@@ -1,41 +0,0 @@
--    hg init testrepo
--    hg commit -A -m 'Added «createrepo.zsh»' \
--    hg mv createrepo.zsh crepo.zsh
--    hg commit -A -m 'Renamed «createrepo.zsh» to «crepo.zsh»' \
--    hg commit -m $'Replaced\n    {\n        ...\n    }\nwith\n    {\n        ...\n    }' \
--    hg mv crepo.zsh chgrepo.zsh
--    hg commit -A -m 'Renamed «crepo.zsh» to «chgrepo.zsh»' \
--    hg commit -A -m 'Added «hglines.lst» and «datelines.lst»' \
--    hg branch A
--    hg commit -A -m 'Added dlines.lst' \
--    hg branch B
--    hg commit -A -m 'Added alines.lst' \
--    hg branch C
--    hg commit -A -m 'Added ablines.lst' \
--    hg tag ablines \
--    hg update default
--    hg merge -r ablines
--    hg commit -m 'Merge from C' \
--    hg update C
--    hg commit -A -m 'Added blines.lst' \
--    hg tag blines \
--    hg update -r -2
--    hg commit -A -m 'Added clines.lst' \
--    hg tag clines \
--    hg update A
--    hg merge -r B
--    hg commit -m 'Merge from B' \
--    hg merge -r clines
--    hg commit -m 'Merge from C:2' \
--    hg update default
--    hg merge -r blines
--    hg commit -m 'Merge from C:1' \
--    hg merge -r A
--    hg commit -m 'Merge from A' \
--    hg cp hglines.lst hglines2.lst
--    hg commit -A -m 'Copied “hglines.lst” to “hglines2.lst”' \
--    hg commit -A -m 'Added nohglines.lst' \
--    hg commit -A -m 'Added nohglinesrev.lst' \
--    hg commit -A -m 'Added ignored10.lst' \
--    hg commit -A -m 'Added .hgignore' \
--    hg rm hglines2.lst
-diff -r df55ab32bcfa nohglinesrev.lst
---- a/nohglinesrev.lst
-+++ b/nohglinesrev.lst
-@@ -51,3 +51,4 @@
- cbaderongi > 'cbA' ohce    
- }
- opertset zx.rat.opertset fJc rat
-+abc
+diff -r df55ab32bcfa addeddef
+--- /dev/null
++++ b/addeddef
+@@ -0,0 +1,1 @@
++Def
+diff -r df55ab32bcfa hglines2.lst
+--- a/hglines2.lst
++++ /dev/null
+@@ -1,41 +0,0 @@
+-    hg init testrepo
+-    hg commit -A -m 'Added «createrepo.zsh»' \
+-    hg mv createrepo.zsh crepo.zsh
+-    hg commit -A -m 'Renamed «createrepo.zsh» to «crepo.zsh»' \
+-    hg commit -m $'Replaced\n    {\n        ...\n    }\nwith\n    {\n        ...\n    }' \
+-    hg mv crepo.zsh chgrepo.zsh
+-    hg commit -A -m 'Renamed «crepo.zsh» to «chgrepo.zsh»' \
+-    hg commit -A -m 'Added «hglines.lst» and «datelines.lst»' \
+-    hg branch A
+-    hg commit -A -m 'Added dlines.lst' \
+-    hg branch B
+-    hg commit -A -m 'Added alines.lst' \
+-    hg branch C
+-    hg commit -A -m 'Added ablines.lst' \
+-    hg tag ablines \
+-    hg update default
+-    hg merge -r ablines
+-    hg commit -m 'Merge from C' \
+-    hg update C
+-    hg commit -A -m 'Added blines.lst' \
+-    hg tag blines \
+-    hg update -r -2
+-    hg commit -A -m 'Added clines.lst' \
+-    hg tag clines \
+-    hg update A
+-    hg merge -r B
+-    hg commit -m 'Merge from B' \
+-    hg merge -r clines
+-    hg commit -m 'Merge from C:2' \
+-    hg update default
+-    hg merge -r blines
+-    hg commit -m 'Merge from C:1' \
+-    hg merge -r A
+-    hg commit -m 'Merge from A' \
+-    hg cp hglines.lst hglines2.lst
+-    hg commit -A -m 'Copied “hglines.lst” to “hglines2.lst”' \
+-    hg commit -A -m 'Added nohglines.lst' \
+-    hg commit -A -m 'Added nohglinesrev.lst' \
+-    hg commit -A -m 'Added ignored10.lst' \
+-    hg commit -A -m 'Added .hgignore' \
+-    hg rm hglines2.lst
+diff -r df55ab32bcfa nohglinesrev.lst
+--- a/nohglinesrev.lst
++++ b/nohglinesrev.lst
+@@ -51,3 +51,4 @@
+ cbaderongi > 'cbA' ohce    
+ }
+ opertset zx.rat.opertset fJc rat
++abc
 w$: 1
 {{{1 cmd
 diff -r df55ab32bcfa addeddef