ZyX_I  committed 3ba62db

@%aurum/drivers/mercurial: Made rf-grep() use --print0

  • Participants
  • Parent commits ae80512

Comments (0)

Files changed (3)

File autoload/aurum/drivers/common/utils.vim

     return cmd
-"▶1 :: sh, hasnulls::0|1|2 → [String] + shell
+"▶1 :: cmd, hasnulls::0|1|2, path → [String] + shell
 function, hasnulls, cdpath)
     if a:hasnulls==2 && !empty(&shellredir)
         return call(s:_r.os.readsystem, [a:cmd]+(empty(a:cdpath)?

File autoload/aurum/drivers/mercurial.vim

     if a:ignore_case
         let kwargs['ignore-case']=1
-    let lines=s:F.hg(a:repo, 'grep', args, kwargs, 1)
+    let kwargs.print0=1
+    let lines=s:F.hg(a:repo, 'grep', args, kwargs, 2)
     if v:shell_error
         " Grep failed because it has found nothing
         if lines ==# ['']
     let r=[]
     let cnmscache={}
-    for line in lines
-        let match=matchlist(line, '\v^(.{-})\:(0|[1-9]\d*)\:([1-9]\d*)\:(.*)$')
-        if empty(match)
-            call s:_f.throw('grepfail', a:repo.path, line)
-        endif
-        let [file, rev, lnum, text]=match[1:4]
-        if a:wdfiles && s:F.checknotmodifiedsince(a:repo, rev, file, cnmscache)
+    let lines=s:_r.utils.nullnl(lines)
+    call remove(lines, -1)
+    while !empty(lines)
+        let [file, rev, lnum, text]=remove(lines, 0, 3)
+        if a:wdfiles && index(allfiles, file)!=-1 &&
+                    \s:F.checknotmodifiedsince(a:repo, rev, file, cnmscache)
             let filename=s:_r.os.path.normpath(s:_r.os.path.join(a:repo.path,
                         \                      file))
         let r+=[{'filename': filename, 'lnum': lnum, 'text': text}]
         unlet filename
-    endfor
+    endwhile
     return r

File doc/aurum.txt

        replaced with static string "HEAD".
 |aurum-rf-status|: For non-python driver this function does not support names 
     containing newlines.
-|aurum-rf-grep|: For non-python driver filenames that look like 
-    {smth}:{num>=0}:{num>0} are not supported and will lead to invalid 
-    results.
 |aurum-rf-diff| requires at least mercurial-1.4 to support reverse diff 
+|aurum-rf-getcsprop|(…, "children") requires at least mercurial-1.7 or manual 
+    preceding |aurum-rf-getchangesets| call. Thus many Next mappings do not 
+    work.
 *aurum-rf-svnrev* exists and produces svn revision number out of repository 
     object and mercurial revision specification.
 *aurum-rf-githex* exists and produces git sha1 out of repository object and