Commits

ZyX_I  committed 3b86917

@aurum: Changed order of :AuOther arguments
@aurum/drivers/mercurial: Made rf-push() use --new-branch
tests: Initial version of :AuOther tests. Only tests for push and pull with or
without {rev} argument

  • Participants
  • Parent commits e94520b

Comments (0)

Files changed (9)

File doc/aurum.txt

                 Default: disabled.
     repo        Path. Repository that should be operated upon.
 
-AuOther[!] {action} [{rev}[ {repo}[ {url}]]]                        *:AuOther*
+AuOther[!] {action} [{rev}[ {url}[ {repo}]]]                        *:AuOther*
     Push, pull or view what will be pushed or pulled. {rev} determines 
     revision to be pushed/pulled, {url} determines where it should be pushed 
     to/pulled from. If bang is present, then push even to unrelated 
-    repositories. Possible actions:
+    repositories. Use ":" instead of any optional argument to get the same 
+    behavior as if it was not specified.
+    Possible actions:
     Action    Description ~
     push      Push
     pull      Pull
     3.0: Moved setlines and some other functions to @aurum/lineutils
     3.1: Added |aurum-rf-push| and |aurum-rf-pull|
 @aurum:
-    0.1: Added :AuBranch and :AuName.
+    0.1: Added |:AuBranch| and |:AuName|.
+    0.2: Added |:AuOther|.
 @aurum/edit:
     1.0: Removed setlines function (moved it to @aurum/repo).
     1.1: Added “requiresbvar” _f.newcommand option.

File plugin/aurum.vim

 scriptencoding utf-8
 if !exists('s:_pluginloaded')
     "▶2 frawor#Setup
-    execute frawor#Setup('0.1', {'@/commands': '0.0',
+    execute frawor#Setup('0.2', {'@/commands': '0.0',
                 \               '@/functions': '0.0',
                 \                   '@/table': '0.0',
                 \                '@/mappings': '0.0',
 let s:pushactions=['push', 'outgoing']
 let s:pullactions=['pull', 'incoming']
 let s:ppactions=s:pushactions+s:pullactions
-function s:othfunc.function(bang, action, rev, repo, url)
+function s:othfunc.function(bang, action, rev, url, repo)
     let repo=s:_r.repo.get(a:repo)
     call s:_r.cmdutils.checkrepo(repo)
     let key=((index(s:pushactions, a:action)==-1)?('pull'):('push'))
 let s:othfunc['@FWC']=['-onlystrings _ '.
             \          'in ppactions ~ smart '.
             \          '[:":" type "" '.
-            \          '['.s:_r.cmdutils.nogetrepoarg.' '.
-            \          '[:":" type ""]]]', 'filter']
+            \          '[:":" type ""'.
+            \          '['.s:_r.cmdutils.nogetrepoarg.']]]', 'filter']
 call add(s:othcomp, substitute(s:othfunc['@FWC'][0],
             \'\Vtype ""', s:_r.comp.rev, ''))
 "▶1

File plugin/aurum/drivers/mercurial.vim

     endif
     if a:force
         let kwargs.force=1
+    elseif a:cmd is# 'push'
+        let kwargs['new-branch']=1
     endif
     return s:F.runcmd(a:repo, a:cmd, args, kwargs)
 endfunction

File python/aurum.py

             kwargs['force']=False
         if 'bundle' not in kwargs:
             kwargs['bundle']=None
+        for key in [key for key in kwargs if key.find('-')!=-1]:
+            newkey=key.replace('-', '_')
+            kwargs[newkey]=kwargs.pop(key)
         cargs=[repo.ui, repo]
         cargs.extend(args)
         run_in_dir(repo.root, commands.__getattribute__(attr),

File 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 -: initial state
+:Run AuLog
+:bwipeout
+:W{{{1 ^: initial state
+:Run! AuLog hgtestbranchedrepo
+:bwipeout
+:W{{{1 A: default push C from B
+:cd cmd-other-B
+:AuOther push C
+:cd -
+:Run! AuLog cmd-other-A
+:bwipeout
+:W{{{1 A: default push from B
+:cd cmd-other-B
+:AuOther push
+:cd -
+:Run! AuLog cmd-other-A
+:bwipeout
+:W{{{1 A: default pull E from ^
+:cd cmd-other-A
+:AuOther pull E
+:Run! AuLog
+:bwipeout
+:cd -
+:W{{{1 A: default pull from ^
+:cd cmd-other-A
+:AuOther pull
+:Run! AuLog
+:bwipeout
+:cd -

File test/cmd-other.ok

+{{{1 A: initial state
+o  Changeset 2:0b0d4d56554b5a2439eba777334922bacd82c62b (branch B)
+|  Commited 01 Янв 1990 00:00 by A
+|  Tags: tip
+|  @ 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: 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>
+|  Tags: tip
+|  @ Renamed «createrepo.zsh» to «crepo.zsh»
+|  
+o  Changeset 0:99ea42d70fbe32af955de907352999b1d94bef5f
+|  Commited 02 Янв 1999 05:20 by A <a@example.com>
+|  @ Added «createrepo.zsh»
+|  
+{{{1 ^: initial state
+@  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
+|    
+o  Changeset 0:9c5c19d8e23488513c07f28024bdf574f4c9db6c
+|  Commited 01 Янв 1990 00:00 by A
+|  @ Added a
+|  
+{{{1 A: default push C from B
+o  Changeset 3:58f8042cd923ab6401693b8abe3d00f14c9dc7cc (branch C)
+|  Commited 01 Янв 1990 00:00 by A
+|  Tags: tip
+|  @ 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: default push from B
+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
+|    
+| @  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: default 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
+|    
+| @  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: default 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
+   

File test/createhgrepo.zsh

     echo 'Abc' > ignoredabc
 )
 tar cJf hgtestrepo.tar.xz hgtestrepo
+(
+    workon mercurial-1.2
+    hg init hgtestbranchedrepo
+    pushd hgtestbranchedrepo
+    function branch() {
+        local -r BRANCH=$1
+        hg update default
+        hg branch $BRANCH
+        echo $BRANCH > a
+        hg commit -m "Added branch $BRANCH" \
+            --date '1990-01-01 00:00' --user A
+    }
+    echo a>a
+    hg commit -A -m 'Added a' \
+        --date '1990-01-01 00:00' --user A
+    branch A
+    branch B
+    branch C
+    branch D
+    branch E
+    branch F
+)
+tar cJf hgtestbranchedrepo.tar.xz hgtestbranchedrepo

File test/gentests-setuptestrepos.zsh

 #!/bin/zsh
 emulate -L zsh
 tar xJf hgtestrepo.tar.xz
+tar xJf hgtestbranchedrepo.tar.xz
 
 tar xJf gittestrepo.tar.xz
 tar xJf gitteststatusrepo.tar.xz
     mkdir ${test}repo
     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
+
 hg clone hgtestrepo hgtestrepo-cloned
 for test in *.in ; do
     [[ $test == drivers-* ]] && continue

File test/hgtestbranchedrepo.tar.xz

Binary file added.