Commits

ZyX_I  committed 8bc7d6b

@%aurum/drivers/bazaar: Various fixes:
- Fixed s:F.getstatdict trying to use unavailable changeset
- Fixed rf-status() not respecting the fact that zero is used instead of
None to indicate absense of argument
- Fixed rf-annotate() and rf-status() that forgot about trailing newline
- Fixed rf-diff():
1. it was failing because “bzr diff” worked like “diff” and returned
1 when there are changes
2. there was code left from git driver and causing it to fail

  • Participants
  • Parent commits 265f543
  • Branches bzr-support

Comments (0)

Files changed (1)

File autoload/aurum/drivers/bazaar.vim

             \             'from the repository %s: %s',
             \     'logf': 'Failed to list all revisions '.
             \             'in the repository %s: %s',
+            \      'csf': 'Failed to get information about revision %s '.
+            \             'in the repository %s: %s',
             \      'lsf': 'Failed to list files in the changeset %s '.
             \             'from the repository %s: %s',
-            \    'statf': 'Failed to get status for the changeset %s '.
-            \             'in the repository %s: %s',
+            \    'statf': 'Failed to get status in the repository %s: %s',
             \   'labelf': 'Failed to set %s “%s” for the changeset %s '.
             \             'in the repository %s: %s',
             \  'revertf': 'Failet to revert to the changeset %s '.
 function s:F.getstatdict(repo, args, kwargs)
     let status=s:F.bzr(a:repo, 'status', a:args,
                 \      extend({'no-classify': 1}, a:kwargs), 0,
-                \      'statf', a:cs.hex)
+                \      'statf')[:-2]
     let curstatus=0
     let statdict={}
     while !empty(status)
             \       'unknown': [],
             \       'ignored': []}
 function s:bzr.status(repo, ...)
-    let statdict=s:F.getstatdict(a:repo, ['--']+get(a:000, 2, []),
+    let statdict=s:F.getstatdict(a:repo, ['--']+((a:0>2 && a:3 isnot 0)?
+                \                                   (a:3):
+                \                                   ([])),
                 \                ((a:0>1 && a:1 isnot 0 && a:2 isnot 0)?
                 \                   ({'revision': a:1.'..'.a:2}):
                 \                ((a:0>0 && a:1 isnot 0)?
                 \   'labelf', a:type, a:label, a:rev)
 endfunction
 "▶1 bzr.update :: repo, rev, force → + FS
-" XXX This must not transform {rev} into hash: it will break rf-branch()
 function s:bzr.update(repo, rev, force)
     let kwargs={}
     let kwargs.revision=''.a:rev
 function s:bzr.annotate(repo, rev, file)
     let ann=s:F.bzr(a:repo, 'annotate', ['--', a:file],
                 \   {'rev': a:rev, 'show-ids': 1}, 2,
-                \   'annotatef', a:file, a:rev)
+                \   'annotatef', a:file, a:rev)[:-2]
     let lastid=0
     let r=[]
     let idamap={}
                 let kwargs.revision.='..'.a:rev1
             endif
         endif
-        let args+=[a:rev2]
-        if !empty(a:rev1)
-            let args[-1].='..'.a:rev1
-        endif
     endif
     if !empty(a:files)
         let args+=['--']+a:files
     endif
-    let r=s:F.bzr(a:repo, 'diff', args, kwargs, 1,
-                \ 'difff', a:rev1, a:rev2, join(a:files, ', '))
+    let r=s:F.bzr(a:repo, 'diff', args, kwargs, 1)
+    " 0 is returned when repository is unchanged
+    " 1 is returned when repository has changes
+    " 2 and further indicate an error
+    if v:shell_error>1
+        call s:_f.throw('difff', a:rev1, a:rev2, join(a:files, ', '))
+    endif
     return r
 endfunction
 "▶1 bzr.diffre :: _, opts → Regex