Commits

ZyX_I committed b0b1c4c

@aurum/file: Fixed :AuFile replace
@aurum/drivers/mercurial: Fixed rf-grep for newer mercurial versions (--follow must not be specified if there are files not present in working directory parent)
tests: Added two-arguments push/pull tests

Comments (0)

Files changed (6)

plugin/aurum/drivers/mercurial.vim

             \                   '("--rev=".join(v:val, "..")):'.
             \                   '("--rev=".v:val))')+
             \['--', a:pattern]+a:files
-    let kwargs={'follow': 1, 'line-number': 1}
+    let kwargs={'line-number': 1}
+    let allfiles=a:repo.functions.getcsprop(a:repo, '.', 'allfiles')
+    let kwargs.follow=empty(filter(copy(a:files), 'index(allfiles, v:val)==-1'))
     if a:ignore_case
         let kwargs['ignore-case']=1
     endif

plugin/aurum/file.vim

         let rev=repo.functions.getrevhex(repo, a:rev)
     endif
     if get(a:opts, 'replace', 0)
+        let winview=winsaveview()
+        silent %delete _
         call s:_r.lineutils.setlines(repo.functions.readfile(repo, rev, file),0)
+        call winrestview(winview)
         return
     endif
     if hasbuf
         if not revisions:
             revisions=None
         kwargs={'rev': revisions, 'ignore_case': bool(ignore_case),
-                'line_number': True, 'follow': True, 'print0': True}
+                'line_number': True, 'print0': True}
+        cs=g_cs(repo, '.')
+        kwargs['follow']=not [f for f in files if f not in cs]
         run_in_dir(repo.root, commands.grep, *args, **kwargs)
         items=(ui._getCaptured(verbatim=True)).split("\0")
         # XXX grep uses "\0" as a terminator, thus last line ends with "\0"

test/cmd-other.in

 :W{{{1 B: initial state
 :Run! AuLog cmd-other-B
 :bwipeout
+:W{{{1 C: initial state
+:Run! AuLog cmd-other-C
+:bwipeout
 :W{{{1 -: initial state
 :Run AuLog
 :bwipeout
 :Run! AuLog
 :bwipeout
 :cd -
+:W{{{1 B: push E from ^
+:cd hgtestbranchedrepo
+:AuOther push E ../cmd-other-B
+:cd -
+:Run! AuLog cmd-other-B
+:bwipeout
+:W{{{1 B: push from ^
+:cd hgtestbranchedrepo
+:AuOther push : ../cmd-other-B
+:cd -
+:Run! AuLog cmd-other-B
+:bwipeout
+:W{{{1 C: pull E from ^
+:cd cmd-other-C
+:AuOther pull E ../hgtestbranchedrepo
+:Run! AuLog
+:bwipeout
+:cd -
+:W{{{1 C: pull from ^
+:cd cmd-other-C
+:AuOther pull : ../hgtestbranchedrepo
+:Run! AuLog
+:bwipeout
+:cd -

test/cmd-other.ok

 |  Commited 01 Янв 1990 00:00 by A
 |  @ Added a
 |  
+{{{1 C: initial state
+o  Changeset 4:5d3f3d9c82536463d8dd331869ea001ed6be0d80 (branch D)
+|  Commited 01 Янв 1990 00:00 by A
+|  Tags: tip
+|  @ Added branch D
+|  
+| o  Changeset 3:58f8042cd923ab6401693b8abe3d00f14c9dc7cc (branch C)
+|/   Commited 01 Янв 1990 00:00 by A
+|    @ Added branch C
+|    
+| o  Changeset 2:0b0d4d56554b5a2439eba777334922bacd82c62b (branch B)
+|/   Commited 01 Янв 1990 00:00 by A
+|    @ Added branch B
+|    
+| o  Changeset 1:a9ddcc9b20848f8d9b12d11379a3461aa1385476 (branch A)
+|/   Commited 01 Янв 1990 00:00 by A
+|    @ Added branch A
+|    
+@  Changeset 0:9c5c19d8e23488513c07f28024bdf574f4c9db6c
+|  Commited 01 Янв 1990 00:00 by A
+|  @ Added a
+|  
 {{{1 -: initial state
 @  Changeset 1:dfe39aa48c6ddde158e42217548b531a45ff66e9
 |  Commited 05 Янв 2000 07:30 by A <a@example.com>
    Commited 01 Янв 1990 00:00 by A
    @ Added a
    
+{{{1 B: push E from ^
+o  Changeset 5:5f59b65b87b3373b59ebd0b491332ffc149268d2 (branch E)
+|  Commited 01 Янв 1990 00:00 by A
+|  Tags: tip
+|  @ Added branch E
+|  
+| o  Changeset 4:5d3f3d9c82536463d8dd331869ea001ed6be0d80 (branch D)
+|/   Commited 01 Янв 1990 00:00 by A
+|    @ Added branch D
+|    
+| o  Changeset 3:58f8042cd923ab6401693b8abe3d00f14c9dc7cc (branch C)
+|/   Commited 01 Янв 1990 00:00 by A
+|    @ Added branch C
+|    
+| o  Changeset 2:0b0d4d56554b5a2439eba777334922bacd82c62b (branch B)
+|/   Commited 01 Янв 1990 00:00 by A
+|    @ Added branch B
+|    
+| o  Changeset 1:a9ddcc9b20848f8d9b12d11379a3461aa1385476 (branch A)
+|/   Commited 01 Янв 1990 00:00 by A
+|    @ Added branch A
+|    
+@  Changeset 0:9c5c19d8e23488513c07f28024bdf574f4c9db6c
+   Commited 01 Янв 1990 00:00 by A
+   @ Added a
+   
+{{{1 B: push from ^
+o  Changeset 6:be69e1f56684ac9eef6d4ac8f517f492d5d7c540 (branch F)
+|  Commited 01 Янв 1990 00:00 by A
+|  Tags: tip
+|  @ Added branch F
+|  
+| o  Changeset 5:5f59b65b87b3373b59ebd0b491332ffc149268d2 (branch E)
+|/   Commited 01 Янв 1990 00:00 by A
+|    @ Added branch E
+|    
+| o  Changeset 4:5d3f3d9c82536463d8dd331869ea001ed6be0d80 (branch D)
+|/   Commited 01 Янв 1990 00:00 by A
+|    @ Added branch D
+|    
+| o  Changeset 3:58f8042cd923ab6401693b8abe3d00f14c9dc7cc (branch C)
+|/   Commited 01 Янв 1990 00:00 by A
+|    @ Added branch C
+|    
+| o  Changeset 2:0b0d4d56554b5a2439eba777334922bacd82c62b (branch B)
+|/   Commited 01 Янв 1990 00:00 by A
+|    @ Added branch B
+|    
+| o  Changeset 1:a9ddcc9b20848f8d9b12d11379a3461aa1385476 (branch A)
+|/   Commited 01 Янв 1990 00:00 by A
+|    @ Added branch A
+|    
+@  Changeset 0:9c5c19d8e23488513c07f28024bdf574f4c9db6c
+   Commited 01 Янв 1990 00:00 by A
+   @ Added a
+   
+{{{1 C: pull E from ^
+o  Changeset 5:5f59b65b87b3373b59ebd0b491332ffc149268d2 (branch E)
+|  Commited 01 Янв 1990 00:00 by A
+|  Tags: tip
+|  @ Added branch E
+|  
+| o  Changeset 4:5d3f3d9c82536463d8dd331869ea001ed6be0d80 (branch D)
+|/   Commited 01 Янв 1990 00:00 by A
+|    @ Added branch D
+|    
+| o  Changeset 3:58f8042cd923ab6401693b8abe3d00f14c9dc7cc (branch C)
+|/   Commited 01 Янв 1990 00:00 by A
+|    @ Added branch C
+|    
+| o  Changeset 2:0b0d4d56554b5a2439eba777334922bacd82c62b (branch B)
+|/   Commited 01 Янв 1990 00:00 by A
+|    @ Added branch B
+|    
+| o  Changeset 1:a9ddcc9b20848f8d9b12d11379a3461aa1385476 (branch A)
+|/   Commited 01 Янв 1990 00:00 by A
+|    @ Added branch A
+|    
+@  Changeset 0:9c5c19d8e23488513c07f28024bdf574f4c9db6c
+   Commited 01 Янв 1990 00:00 by A
+   @ Added a
+   
+{{{1 C: pull from ^
+o  Changeset 6:be69e1f56684ac9eef6d4ac8f517f492d5d7c540 (branch F)
+|  Commited 01 Янв 1990 00:00 by A
+|  Tags: tip
+|  @ Added branch F
+|  
+| o  Changeset 5:5f59b65b87b3373b59ebd0b491332ffc149268d2 (branch E)
+|/   Commited 01 Янв 1990 00:00 by A
+|    @ Added branch E
+|    
+| o  Changeset 4:5d3f3d9c82536463d8dd331869ea001ed6be0d80 (branch D)
+|/   Commited 01 Янв 1990 00:00 by A
+|    @ Added branch D
+|    
+| o  Changeset 3:58f8042cd923ab6401693b8abe3d00f14c9dc7cc (branch C)
+|/   Commited 01 Янв 1990 00:00 by A
+|    @ Added branch C
+|    
+| o  Changeset 2:0b0d4d56554b5a2439eba777334922bacd82c62b (branch B)
+|/   Commited 01 Янв 1990 00:00 by A
+|    @ Added branch B
+|    
+| o  Changeset 1:a9ddcc9b20848f8d9b12d11379a3461aa1385476 (branch A)
+|/   Commited 01 Янв 1990 00:00 by A
+|    @ Added branch A
+|    
+@  Changeset 0:9c5c19d8e23488513c07f28024bdf574f4c9db6c
+   Commited 01 Янв 1990 00:00 by A
+   @ Added a
+   

test/gentests-setuptestrepos.zsh

 #!/bin/zsh
 emulate -L zsh
+
+typeset -r LOGFILE=$PWD/gentests-setuptestrepos.log
+
+function silent()
+{
+    echo "{{{1 Running "${(q)@} > $LOGFILE
+    $@ >$LOGFILE
+}
+
 tar xJf hgtestrepo.tar.xz
 tar xJf hgtestbranchedrepo.tar.xz
 
 tar xJf svntestreposerver.tar.xz
 mkdir svntestrepo-subdirserver
 tar c -C svntestreposerver . | ( cd svntestrepo-subdirserver && tar x )
-svn checkout file://$PWD/svntestreposerver svntestrepo
-svn checkout file://$PWD/svntestrepo-subdirserver/subdir svntest-subdirrepo
+silent svn checkout file://$PWD/svntestreposerver svntestrepo
+silent svn checkout file://$PWD/svntestrepo-subdirserver/subdir svntest-subdirrepo
 
 for test in cmd-annotate-buffers cmd+maps-commit cmd-record cmd-status \
             maps-status cmd-vimdiff cmd-diff cmd-update opts-remembermsg \
     tar c -C hgtestrepo . | (cd ${test}repo && tar x)
 done
 
-hg clone hgtestbranchedrepo cmd-other-A -r A -r B
-hg clone cmd-other-A        cmd-other-B
-hg pull -R cmd-other-B hgtestbranchedrepo -r C -r D
-hg clone hgtestrepo cmd-otherrepo -r 1
+silent hg clone hgtestbranchedrepo cmd-other-A -r A -r B
+silent hg clone cmd-other-A        cmd-other-B
+silent hg pull -R cmd-other-B hgtestbranchedrepo -r C -r D
+silent hg clone cmd-other-B        cmd-other-C
+silent hg clone hgtestrepo cmd-otherrepo -r 1
 
-hg clone hgtestrepo hgtestrepo-cloned
 for test in *.in ; do
     [[ $test == drivers-* ]] && continue
     test=$test:r
     [[ -d ${test}repo ]] && continue
-    mkdir ${test}repo
-    tar c -C hgtestrepo-cloned . | (cd ${test}repo && tar x)
+    silent hg clone hgtestrepo ${test}repo
 done
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.