ZyX_I committed aeb3c2e

Fixed absence of d.startrev in non-python driver (strange, but it did not cause tests to fail, so I do not really know whether fix is right)

Comments (0)

Files changed (3)

     it is not mentioned in function descriptions. Here is the list:
   repo :: path -> repo                                         *aurum-rf-repo*
     Creates new repository object using repository located at given path.
+    Note you must not ever use this directly, this is to be called by repo.get 
+         function from plugin/aurum/repo. If you use it directly, you will be 
+         missing some setup that will render newly created object useless.
   commit :: message[, [ file ][, user[, date[, closebranch[, force]]]]] -> _
     Commit changes made to specified files (default depends on VCS, normally 
     revision number, ... - whatever VCS supports) get changeset hash.
     Note that functions mentioned above may support not only revision hashes 
          in place of {hex} arguments, but also whatever `getrevhex' supports, 
-         but this is not guaranteed.
+         but this is not guaranteed. For example, status() accepts revision 
+         number in both mercurial drivers, but though zero is a valid 
+         revision, it is used to indicate absence of an argument and thus you 
+         have to write '0' (String) where you want to write just 0 (Number).
   updatechangesets :: () -> _                      *aurum-rf-updatechangesets*
     Updates data stored in repository. Is called automatically when you get 
     the repository object unless this object is obtained from cash used by 


     function s:F.getupdates(repo, start)
         let r={}
-        let r.css=s:F.getcslist(a:repo, a:start, -1)
+        let a:repo.work_hex=a:repo.functions.getrevhex(a:repo, '.')
+        let tip_hex=a:repo.functions.getrevhex(a:repo, 'tip')
+        if a:start
+            try
+                let oldtip=a:repo.functions.getcs(a:repo, a:start)
+                if tip_hex is# oldtip.hex
+                    return r
+                endif
+                let startrev=oldtip.rev
+            catch
+                let startrev=0
+            endtry
+        else
+            let startrev=0
+        endif
+        let r.startrev=startrev
+        let r.css=s:F.getcslist(a:repo, startrev, -1)
         for key in ['tags', 'bookmarks']
             let list=s:F.getkeylist(a:repo, key)
             let r[key]={}
         let a:repo.csnum=a:start+len(r.css)
-        let a:repo.tip_hex=a:repo.functions.getrevhex(a:repo, 'tip')
-        let a:repo.work_hex=a:repo.functions.getrevhex(a:repo, '.')
-        " " FIXME
-        " let r.startrev=
+        let a:repo.tip_hex=tip_hex
         return r
 let s:initstatdct={}
 call map(values(s:hgstatchars), 'extend(s:initstatdct, {v:val : []})')
+" TODO test whether zero revision may cause bugs in some commands
 function s:hg.status(repo, ...)
     let cmd='status -marduic'
     let reverse=0
     let r=deepcopy(s:initstatdct)
     call map(copy(slines), 'add(r[s:hgstatchars[v:val[0]]], v:val[2:])')
-    if a:0>2
+    if a:0>2 && !empty(a:3)
         call map(r, 'map(v:val, "a:repo.functions.reltorepo(a:repo, v:val)")')
     if reverse


 let s:repos={}
 "▶1 dirty :: repo, file → Bool
 function s:F.dirty(repo, file)
-    let status=a:repo.functions.status(a:repo)
+    let status=a:repo.functions.status(a:repo, 0, 0, [a:file])
     for [type, files] in items(status)
         if type is# 'ignored' || type is# 'clean'