changeset 647:3ff8666b1479

maps: rename revmap.seen to revmap.youngest; add revmap.oldest.
author Dan Villiom Podlaski Christiansen <danchr@gmail.com>
date Tue, 20 Jul 2010 11:55:07 +0200
parents f12257bf8b91
children 8fb38602e3ed
files hgsubversion/maps.py hgsubversion/wrappers.py
diffstat 2 files changed, 13 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/hgsubversion/maps.py
+++ b/hgsubversion/maps.py
@@ -178,7 +178,8 @@ class RevMap(dict):
     def __init__(self, repo):
         dict.__init__(self)
         self.path = os.path.join(repo.path, 'svn', 'rev_map')
-        self.seen = 0
+        self.youngest = 0
+        self.oldest = 0
         if os.path.isfile(self.path):
             self._load()
         else:
@@ -204,7 +205,10 @@ class RevMap(dict):
             else:
                 branch = branch[:-1]
             revnum = int(revnum)
-            self.seen = max(self.seen, revnum)
+            if revnum > self.youngest or not self.youngest:
+                self.youngest = revnum
+            if revnum < self.oldest or not self.oldest:
+                self.oldest = revnum
             dict.__setitem__(self, (revnum, branch), node.bin(hash))
         f.close()
 
@@ -221,7 +225,10 @@ class RevMap(dict):
         f.write(str(revnum) + ' ' + node.hex(hash) + ' ' + b + '\n')
         f.flush()
         f.close()
-        self.seen = max(self.seen, revnum)
+        if revnum > self.youngest or not self.youngest:
+            self.youngest = revnum
+        if revnum < self.oldest or not self.oldest:
+            self.oldest = revnum
         dict.__setitem__(self, (revnum, branch), hash)
 
 
--- a/hgsubversion/wrappers.py
+++ b/hgsubversion/wrappers.py
@@ -62,7 +62,7 @@ def incoming(orig, ui, repo, source='def
     meta = repo.svnmeta()
 
     ui.status('incoming changes from %s\n' % other.svnurl)
-    for r in other.svn.revisions(start=meta.revmap.seen):
+    for r in other.svn.revisions(start=meta.revmap.youngest):
         ui.status('\n')
         for label, attr in revmeta:
             l1 = label + ':'
@@ -235,8 +235,8 @@ def pull(repo, source, heads=[], force=F
         repo.ui.setconfig('hgsubversion', 'layout', layout)
         repo.ui.note('using %s layout\n' % layout)
 
-    start = max(meta.revmap.seen, skipto_rev)
-    initializing_repo = meta.revmap.seen <= 0
+    start = max(meta.revmap.youngest, skipto_rev)
+    initializing_repo = meta.revmap.youngest <= 0
     ui = repo.ui
 
     if initializing_repo and start > 0: