Source

aurum / python / aurum / aubazaar.py

Diff from to

python/aurum/aubazaar.py

         'bookmarks' : [],
 }
 
-def set_rev_dict(cs, cs_vim, revid_revno_map, reverse_tag_dict):
+def set_rev_dict(cs, cs_vim, reverse_tag_dict):
     cs_vim['hex']         = cs.revision_id
-    cs_vim['rev']         = revid_revno_map[cs.revision_id]
     cs_vim['time']        = int(cs.timestamp)
     cs_vim['description'] = cs.message.encode('utf-8')
 
     cs_vim.update(cs_vim_defaults)
     return cs_vim
 
+def g_revno(repo, revid):
+    return repo.branch.revision_id_to_revno(revid)
+
+@outermethod
+@autoexportmethod()
+@bzrmethod
+def get_updates(repo, oldtip=None):
+    revno = repo.branch.revno()
+    tiprev = g_cs(repo, revno)
+    if oldtip is not None:
+        try:
+            oldtiprev = g_cs(repo, oldtip)
+        except Exception:
+            return get_updates_unchanged(repo)
+
+        if tiprev.revision_id == oldtiprev.revision_id:
+            return {'startrev': g_revno(startrev),
+                        'tags': dict(((str(key), value)
+                                    for key, value
+                                    in repo.branch.tags.get_tag_dict().iteritems())),
+                   }
+        else:
+            startrev = g_revno(oldtiprev)
+            known_revisions = set(vim.eval('keys(a:repo.changesets)'))
+            css = []
+            for revid, merge_depth, revno, end_of_merge \
+                    in repo.branch.iter_merge_sorted_revisions(
+                            start_revision_id =    tiprev.revision_id,
+                            stop_revision_id  = oldtiprev.revision_id):
+                css.append(set_rev_dict(repo.branch.repository.get_revision(revid),
+                                        {'rev': '.'.join(revno)},
+                                        repo.branch.tags.get_reverse_tag_dict()))
+    else:
+        pass
+
 # vim: ft=python ts=4 sw=4 sts=4 et tw=100