Commits

ZyX_I committed 1d5f758

ftplugin/aurumstatus: Added some throws. Ref #12

Comments (0)

Files changed (1)

ftplugin/aurumstatus.vim

             \                 '@aurum/commit': '0.0',
             \                    '@/mappings': '0.0',
             \                          '@/os': '0.0',})
+let s:_messages={
+            \  'nopars': 'Revision %s has no parents',
+        \}
 "▶1 runmap
 let s:noacttypes={
             \    'open': ['deleted'],
         endif
     endif
     if a:action is# 'open'
-        execute 'silent e' fnameescape(s:_r.os.path.join(bvar.repo.path,file))
+        execute 'silent e' fnameescape(s:_r.os.path.join(bvar.repo.path, file))
     elseif a:action is# 'revopen'
         call s:_r.run('silent edit', 'file', bvar.repo, rev1, file)
     elseif a:action is# 'fulldiff'
                     \                   ('')).rev1.' '.rev2
     elseif a:action is# 'revfullvimdiff'
         let cs1=bvar.repo.functions.getcs(bvar.repo, rev1)
-        if !empty(cs1.parents)
-            call s:_r.vimdiff.full(bvar.repo, [rev1, cs1.parents[0]], 1, [], 0)
+        if empty(cs1.parents)
+            call s:_f.throw('nopars', cs1.hex)
         endif
+        call s:_r.vimdiff.full(bvar.repo, [rev1, cs1.parents[0]], 1, [], 0)
     elseif !manyfiles && (a:action is# 'revvimdiff' || a:action is# 'vimdiff')
         let file1=s:_r.fname('file', bvar.repo, rev1, file)
         if a:action is# 'revvimdiff'
             let cs1=bvar.repo.functions.getcs(bvar.repo, rev1)
             if empty(cs1.parents)
-                return
-            else
-                let file2=s:_r.fname('file', bvar.repo, cs1.parents[0], file)
+                call s:_f.throw('nopars', cs1.hex)
             endif
+            let file2=s:_r.fname('file', bvar.repo, cs1.parents[0], file)
         elseif empty(rev2)
             let file2=s:_r.os.path.join(bvar.repo.path, file)
         else
         if a:action is# 'revvimdiff'
             let cs1=bvar.repo.functions.getcs(bvar.repo, rev1)
             if empty(cs1.parents)
-                return
+                call s:_f.throw('nopars', cs1.hex)
             endif
             let args+=[[cs1.parents[0], rev1]]
         else