Commits

ZyX_I  committed abf7341

Fix some errors in AuIntegrate; add mergemethod option

  • Participants
  • Parent commits eb504ff
  • Branches merge

Comments (0)

Files changed (3)

File autoload/aurum/cmdutils.vim

         endif
         let  rev=0
         let hasbuf=2
+    "▶2 buf | wd → repo
+    elseif a:act is# 'getrr' &&
+                \(isdirectory(expand('%')) || isdirectory(expand('%:h'))
+                \ || isdirectory(getcwd()))
+        let repo=s:_r.repo.get(isdirectory(expand('%'))
+                    \          ? expand('%')
+                    \          : (isdirectory(expand('%:h'))
+                    \             ? expand('%:h')
+                    \             : getcwd()))
+        let rev=0
     "▲2
     elseif a:failmsg isnot 0
         call s:_f.throw(a:failmsg)

File autoload/aurum/integrate.vim

             \                 '@%aurum/bufvars': '0.0',
             \               '@%aurum/lineutils': '0.0',
             \                    '@%aurum/edit': '1.2',
-            \                           '@/fwc': '0.0',
+            \                    '@%aurum/undo': '1.0',
+            \                '@%aurum/tabutils': '1.0',
+            \                     '@/functions': '0.1',
+            \                       '@/options': '0.0',
+            \                           '@/fwc': '0.4',
             \                            '@/os': '0.0',
             \                      '@/mappings': '0.0',})
 let s:_messages={
             \'unresolved': 'Unable to commit: not all conflicts were resolved',
         \}
+let s:_options={
+            \'mergemethod': {'default': '2way', 'checker': 'key F.methods'},
+        \}
 "▶1 genstatus
 function s:F.genstatus(mergedict)
     let files=[]
 endfunction
 "▶1 Methods
 let s:F.methods={}
-let common
 for [s:name, s:tabdesc] in [
             \['2way', {
             \      'top': ['AuIntegrateCurrent', 'AuIntegrateOther'],
 endfunction
 "▶1 run
 let s:statchars='UR r'
-function s:F.run(cmd, opts)
-    let usemarkers=(a:opts.method is# 'markers')
-    let [repo, rev] = s:_r.cmdutils.getrrf({}, 'norev', 'getrr')[1:2]
-    let mergedict=repo.functions.merge(repo, rev, usemarkers)
+function s:F.run(cmd, opts, repo, rev, mergedict)
+    let repo=a:repo
+    let rev=a:rev
+    let mergedict=a:mergedict
     let cs=repo.functions.getcs(repo, rev)
     let sopts={'prefix': 'U'}
     call s:_r.run(a:cmd, 'status', repo, sopts)
         let bvar.copts.amend=1
     endif
     call s:F.resetlines(a:bvar)
-    call s:_r.undo.setup(bvar, s:_f.getoption('fullundo'))
+    call s:_r.undo.setup(bvar)
 endfunction
 "▶1 AuIntegrate
 let s:_aufunctions.cmd={'@FWC': ['-onlystrings '.
             \'{ ?repo    '.s:_r.cmdutils.comp.repo.
             \'  ?rev     '.s:_r.cmdutils.comp.rev.
-            \'  ?method  :"2way" key F.methods'.
+            \'  ?method  :0 key F.methods'.
             \'  ?message type""'.
             \' !?commit'.
             \'}', 'filter']}
 let s:_aufunctions.comp=s:_r.cmdutils.gencompfunc(s:_aufunctions.cmd['@FWC'][0],
             \                                     [], s:_f.fwc.compile)
 function s:_aufunctions.cmd.function(opts)
-    let layout='AuIntegrate_'.a:opts.method
-    call s:_f.tab.create(layout, run, [a:opts])
+    let opts=copy(a:opts)
+    if opts.method is 0
+        let opts.method=s:_f.getoption('mergemethod')
+    endif
+    let layout='AuIntegrate_'.opts.method
+    let [repo, rev]=s:_r.cmdutils.getrrf(opts, 'norev', 'getrr')[1:2]
+    let mergedict=repo.functions.merge(repo, rev, (opts.method is# 'markers'))
+    call s:_f.tab.create(layout, s:F.run, [opts, repo, rev, mergedict])
 endfunction
 "▶1 runstatmap
 let s:foreignactions={

File doc/aurum.txt

     added to the aurum.
     Values of this option are checked before |aurum-repo.hypsites|.
 
+mergemethod                                              *g:aurum_mergemethod*
+    String, determines default merging method. See |:AuIntegrate| for a list.
+    Default: "2way".
+
 The following options are driver-specific:
 
 hg_useshell                                              *g:aurum_hg_useshell*