ZyX_I avatar ZyX_I committed d7134e9

@aurum: Made :AuOther transform URL into full path if it points to directory
Fixed :AuOther completion
@aurum/drivers/mercurial: Made run_in_dir restore directory in case of failure
tests: Added forced pull/push tests

Comments (0)

Files changed (5)

 function s:othfunc.function(bang, action, rev, url, repo)
     let repo=s:_r.repo.get(a:repo)
     call s:_r.cmdutils.checkrepo(repo)
+    if a:url isnot# ':' && stridx(a:url, '://')==-1 && isdirectory(a:url)
+        let url=s:_r.os.path.realpath(a:url)
+    else
+        let url=a:url
+    endif
     let key=((index(s:pushactions, a:action)==-1)?('pull'):('push'))
     return repo.functions[key](repo, (a:action[0] isnot# 'p'), a:bang,
-                \              ((a:url is# ':')?(0):(a:url)),
+                \              ((  url is# ':')?(0):(  url)),
                 \              ((a:rev is# ':')?(0):(a:rev)))
 endfunction
 let s:othfunc['@FWC']=['-onlystrings _ '.
             \          'in ppactions ~ smart '.
             \          '[:":" type "" '.
-            \          '[:":" type ""'.
+            \          '[:":" type "" '.
             \          '['.s:_r.cmdutils.nogetrepoarg.']]]', 'filter']
-call add(s:othcomp, substitute(s:othfunc['@FWC'][0],
+call add(s:othcomp, substitute(substitute(s:othfunc['@FWC'][0],
+            \'\V_ ',      '',            ''),
             \'\Vtype ""', s:_r.comp.rev, ''))
 "▶1
 call frawor#Lockvar(s:, '_pluginloaded,_r')
         pass
     except OSError:
         pass
-    func(*args, **kwargs)
-    os.chdir(workdir)
+    try:
+        func(*args, **kwargs)
+    finally:
+        os.chdir(workdir)
 
 def dodiff(ui, path, rev1, rev2, files, opts):
     repo=g_repo(path)

test/cmd-other.in

-:W{{{1 A: initial state
-:Run! AuLog cmd-other-A
-:bwipeout
-: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
-:W{{{1 ^: initial state
-:Run! AuLog hgtestbranchedrepo
-:bwipeout
+:let g:r={'-': g:curtest.'repo', '^': 'hgtestbranchedrepo'}
+:function R(s)
+    return get(g:r, a:s, 'cmd-other-'.a:s)
+ endfunction
+:function S(s)
+    return substitute(a:s, '@[\^\-A-Z]', '\=R(submatch(0)[1])', 'g')
+ endfunction
+:command -nargs=1       AL  :execute "W{{{1 ".<q-args>.": initial state\nRun! AuLog ".R(<q-args>) | bwipeout
+:command -nargs=1 -bang AO  :let a=<q-args> | execute "AuOther<bang> ".S(a[2:]) | execute "Run! AuLog ".R(a[0]) | bwipeout
+:command -nargs=1 -bang AOa :let a=<q-args> | execute "cd ".R(a[0])."\nAuOther<bang> ".S(a[2:]) | execute "Run! AuLog" | bwipeout | cd -
+:command -nargs=1 -bang AOb :let a=<q-args> | execute "cd ".R(a[0])."\nAuOther<bang> ".S(a[4:]) | cd - | execute "Run! AuLog ".R(a[2]) | bwipeout
+:AL A
+:AL B
+:AL C
+:AL -
+:AL ^
 :W{{{1 A: default push C from B
-:cd cmd-other-B
-:AuOther push C
-:cd -
-:Run! AuLog cmd-other-A
-:bwipeout
+:AOb B A push C
 :W{{{1 A: default push from B
-:cd cmd-other-B
-:AuOther push
-:cd -
-:Run! AuLog cmd-other-A
-:bwipeout
+:AOb B A push
 :W{{{1 A: default pull E from ^
-:cd cmd-other-A
-:AuOther pull E
-:Run! AuLog
-:bwipeout
-:cd -
+:AOa A pull E
 :W{{{1 A: default pull from ^
-:cd cmd-other-A
-:AuOther pull
-:Run! AuLog
-:bwipeout
-:cd -
+:AOa A pull
 :W{{{1 B: push E from ^
-:cd hgtestbranchedrepo
-:AuOther push E ../cmd-other-B
-:cd -
-:Run! AuLog cmd-other-B
-:bwipeout
+:AOb ^ B push E ../@B
 :W{{{1 B: push from ^
-:cd hgtestbranchedrepo
-:AuOther push : ../cmd-other-B
-:cd -
-:Run! AuLog cmd-other-B
-:bwipeout
+:AOb ^ B push : ../@B
 :W{{{1 C: pull E from ^
-:cd cmd-other-C
-:AuOther pull E ../hgtestbranchedrepo
-:Run! AuLog
-:bwipeout
-:cd -
+:AOa C pull E ../@^
 :W{{{1 C: pull from ^
-:cd cmd-other-C
-:AuOther pull : ../hgtestbranchedrepo
-:Run! AuLog
-:bwipeout
-:cd -
+:AOa C pull : ../@^
+:W{{{1 A: pull from -
+:AOa A pull : ../@-
+:W{{{1 A: forced pull from -
+:AOa!A pull : ../@-
+:W{{{1 B: push from -
+:AOb - B push : ../@B
+:W{{{1 B: forced push from -
+:AOb!- B push : ../@B
+:W{{{1 C: forced pull from - to C
+:AO! C pull : @- @C

test/cmd-other.ok

    Commited 01 Янв 1990 00:00 by A
    @ Added a
    
+{{{1 A: 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
+|    
+| @  Changeset 1:a9ddcc9b20848f8d9b12d11379a3461aa1385476 (branch A)
+|/   Commited 01 Янв 1990 00:00 by A
+|    @ Added branch A
+|    
+o  Changeset 0:9c5c19d8e23488513c07f28024bdf574f4c9db6c
+   Commited 01 Янв 1990 00:00 by A
+   @ Added a
+   
+{{{1 A: forced pull from -
+o  Changeset 8:dfe39aa48c6ddde158e42217548b531a45ff66e9
+|  Commited 05 Янв 2000 07:30 by A <a@example.com>
+|  Tags: tip
+|  @ Renamed «createrepo.zsh» to «crepo.zsh»
+|  
+o  Changeset 7:99ea42d70fbe32af955de907352999b1d94bef5f
+|  Commited 02 Янв 1999 05:20 by A <a@example.com>
+|  @ Added «createrepo.zsh»
+|  
+| o  Changeset 6:be69e1f56684ac9eef6d4ac8f517f492d5d7c540 (branch F)
+| |  Commited 01 Янв 1990 00:00 by A
+| |  @ 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
+| |    
+| | @  Changeset 1:a9ddcc9b20848f8d9b12d11379a3461aa1385476 (branch A)
+| |/   Commited 01 Янв 1990 00:00 by A
+| |    @ Added branch A
+| |    
+| o  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 B: forced push from -
+o  Changeset 8:dfe39aa48c6ddde158e42217548b531a45ff66e9
+|  Commited 05 Янв 2000 07:30 by A <a@example.com>
+|  Tags: tip
+|  @ Renamed «createrepo.zsh» to «crepo.zsh»
+|  
+o  Changeset 7:99ea42d70fbe32af955de907352999b1d94bef5f
+|  Commited 02 Янв 1999 05:20 by A <a@example.com>
+|  @ Added «createrepo.zsh»
+|  
+| o  Changeset 6:be69e1f56684ac9eef6d4ac8f517f492d5d7c540 (branch F)
+| |  Commited 01 Янв 1990 00:00 by A
+| |  @ 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: forced pull from - to C
+o  Changeset 8:dfe39aa48c6ddde158e42217548b531a45ff66e9
+|  Commited 05 Янв 2000 07:30 by A <a@example.com>
+|  Tags: tip
+|  @ Renamed «createrepo.zsh» to «crepo.zsh»
+|  
+o  Changeset 7:99ea42d70fbe32af955de907352999b1d94bef5f
+|  Commited 02 Янв 1999 05:20 by A <a@example.com>
+|  @ Added «createrepo.zsh»
+|  
+| o  Changeset 6:be69e1f56684ac9eef6d4ac8f517f492d5d7c540 (branch F)
+| |  Commited 01 Янв 1990 00:00 by A
+| |  @ 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

     [[ -d ${test}repo ]] && continue
     silent hg clone hgtestrepo ${test}repo
 done
+# vim: fmr=▶,▲ ts=4 sts=4 sw=4 et
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.