ZyX_I avatar ZyX_I committed 211cde6

@aurum: Fixed error in findfiles()
Made :AuMove throw an error if no files are moved
tests: Added cmd-move,track,junk-subdir test
Fixed #13

Comments (0)

Files changed (4)

             \ 'nunsup': 'Naming is not supported for repository %s',
             \'ukntype': 'Unknown label type: %s. Supported types: %s',
             \   'ldef': 'Label %s with type %s was alredy defined',
+            \   'nomv': 'No movable files found',
             \'_mvheader': ['Source', 'Destination'],
         \}
 let s:utypes=['html', 'raw', 'annotate', 'filehist', 'bundle', 'changeset',
         endfor
         let d[fsplit[-1]]=1
     endfor
-    unlet d
+    unlet! d
     let patterns=map(copy(a:globs), 's:_r.globtopat('.
                 \                   'a:repo.functions.reltorepo(a:repo,v:val))')
     let tocheck=map(items(dirs), '[v:val[1], v:val[0]]')
             let moves[file]=dest
         endfor
     endif
+    if empty(moves)
+        call s:_f.throw('nomv')
+    endif
     if get(a:opts, 'pretend', 0)
         call s:_r.printtable(items(moves), {'header': s:_messages._mvheader})
     else

test/cmd-move,track,junk-subdir.in

+:command -bar CS :execute 'Run AuStatus' | bwipeout!
+:command -bar WTax :WTA template g:template showfiles showrenames showcopies
+:command -nargs=1 SR :R silent <args>
+:let g:subdir='directory/subdir'
+:let g:template="$rev\n*$changes\n@$description\n>$renames\n+$copies"
+:W{{{1 Track directory
+:R call mkdir(g:subdir)
+:R call writefile(['Dummy string'], g:subdir.'/subfile')
+:R call writefile(['Second dummy string'], g:subdir.'/subfile2')
+:SR AuTrack directory/
+:CS
+:SR AuCommit message Added\ directory/subdir/subfile{,2} **
+:WTax
+:W{{{1 Move directory to unexistent directory
+:SR AuMove directory/ unexistentdir/
+:CS
+:SR AuCommit message Moved\ directory/\ to\ unexistentdir/ **
+:WTax
+:W{{{1 Move directory to an existing directory
+:R call mkdir(g:subdir, 'p')
+:R call writefile(['Dummy string'], g:subdir.'/subfile')
+:SR AuTrack directory/
+:SR AuCommit message Recreated\ directory/subdir/subfile **
+:WTax
+:SR AuMove unexistentdir directory
+:CS
+:SR AuCommit message Moved\ unexistentdir to\ directory **
+:WTax
+:W{{{1 Junk directory
+:SR AuJunk directory
+:CS
+:SR AuCommit message Removed\ directory **
+:WTax
+:source addmessages.vim

test/cmd-move,track,junk-subdir.ok

+{{{1 Track directory
+A directory/subdir/subfile
+A directory/subdir/subfile2
+@  27
+|  *directory/subdir/subfile, directory/subdir/subfile2
+{{{1 Move directory to unexistent directory
+A unexistentdir/file
+A unexistentdir/subdir/subfile
+A unexistentdir/subdir/subfile2
+R directory/file
+R directory/subdir/subfile
+R directory/subdir/subfile2
+@  28
+|  *directory/file, directory/subdir/subfile, directory/subdir/subfile2
+|  *unexistentdir/file, unexistentdir/subdir/subfile
+|  *unexistentdir/subdir/subfile2
+|  @Moved directory/ to unexistentdir/
+|  >directory/file to unexistentdir/file
+|  >directory/subdir/subfile2 to unexistentdir/subdir/subfile2
+{{{1 Move directory to an existing directory
+@  29
+|  *directory/subdir/subfile
+A directory/unexistentdir/file
+A directory/unexistentdir/subdir/subfile
+A directory/unexistentdir/subdir/subfile2
+R unexistentdir/file
+R unexistentdir/subdir/subfile
+R unexistentdir/subdir/subfile2
+@  30
+|  *directory/unexistentdir/file, directory/unexistentdir/subdir/subfile
+|  *directory/unexistentdir/subdir/subfile2, unexistentdir/file
+|  *unexistentdir/subdir/subfile, unexistentdir/subdir/subfile2
+|  @Moved unexistentdir
+|  >unexistentdir/file to directory/unexistentdir/file
+|  >unexistentdir/subdir/subfile to directory/unexistentdir/subdir/subfile
+{{{1 Junk directory
+R directory/subdir/subfile
+R directory/unexistentdir/file
+R directory/unexistentdir/subdir/subfile
+R directory/unexistentdir/subdir/subfile2
+@  31
+|  *directory/subdir/subfile, directory/unexistentdir/file
+|  *directory/unexistentdir/subdir/subfile
+|  *directory/unexistentdir/subdir/subfile2
     let tipname=get(g:, 'tipname', 'tip')
     execute 'R AuLog limit 1 revision '.tipname.' '.a:addargs
     setlocal modifiable noreadonly
-    if !a:writecom
-        g/Commited/delete _
+    if a:writecom!=2
+        if !a:writecom
+            g/Commited/delete _
+        endif
+        normal! gg0f:"_de
     endif
-    normal! gg0f:"_de
     if !empty(a:cmd)
         execute a:cmd
     endif
 endfunction
 command -nargs=? -bar -bang WT  :call s:WriteTip(<bang>0, <q-args>, '')
 command -nargs=1 -bar -bang WTa :call s:WriteTip(<bang>0, '', <q-args>)
+command -nargs=1 -bar       WTA :call s:WriteTip(      2, '', <q-args>)
 function s:WriteWindows()
     let wcur=winnr()
     let wprev=winnr('#')
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.