mq: use contexts
authorBenoit Boissinot <benoit.boissinot@ens-lyon.org>
Tue, 26 Dec 2006 03:29:00 +0100
changeset 3980 e9460fe2f548
parent 3979 e0d13267f7a4
child 3981 180670f14045
mq: use contexts
hgext/mq.py
--- a/hgext/mq.py	Tue Dec 26 03:27:24 2006 +0100
+++ b/hgext/mq.py	Tue Dec 26 03:29:00 2006 +0100
@@ -326,11 +326,12 @@
         hg.clean(repo, head, wlock=wlock)
         self.strip(repo, n, update=False, backup='strip', wlock=wlock)
 
-        c = repo.changelog.read(rev)
+        ctx = repo.changectx(rev)
         ret = hg.merge(repo, rev, wlock=wlock)
         if ret:
             raise util.Abort(_("update returned %d") % ret)
-        n = repo.commit(None, c[4], c[1], force=1, wlock=wlock)
+        n = repo.commit(None, ctx.description(), ctx.user(),
+                        force=1, wlock=wlock)
         if n == None:
             raise util.Abort(_("repo commit failed"))
         try:
@@ -612,15 +613,12 @@
             self.ui.warn("saving bundle to %s\n" % name)
             return changegroup.writebundle(cg, name, "HG10BZ")
 
-        def stripall(rev, revnum):
-            cl = repo.changelog
-            c = cl.read(rev)
-            mm = repo.manifest.read(c[0])
+        def stripall(revnum):
+            mm = repo.changectx(rev).manifest()
             seen = {}
 
-            for x in xrange(revnum, cl.count()):
-                c = cl.read(cl.node(x))
-                for f in c[3]:
+            for x in xrange(revnum, repo.changelog.count()):
+                for f in repo.changectx(x).files():
                     if f in seen:
                         continue
                     seen[f] = 1
@@ -702,7 +700,7 @@
             chgrpfile = bundle(backupch)
             chgrpfile = 'file:%s' % chgrpfile
 
-        stripall(rev, revnum)
+        stripall(revnum)
 
         change = chlog.read(rev)
         chlog.strip(revnum, revnum)