hgext/mq.py
changeset 3980 e9460fe2f548
parent 3963 ba45041827a2
child 3982 714fbfe5c9e5
equal deleted inserted replaced
3979:e0d13267f7a4 3980:e9460fe2f548
   324 
   324 
   325         # apply failed, strip away that rev and merge.
   325         # apply failed, strip away that rev and merge.
   326         hg.clean(repo, head, wlock=wlock)
   326         hg.clean(repo, head, wlock=wlock)
   327         self.strip(repo, n, update=False, backup='strip', wlock=wlock)
   327         self.strip(repo, n, update=False, backup='strip', wlock=wlock)
   328 
   328 
   329         c = repo.changelog.read(rev)
   329         ctx = repo.changectx(rev)
   330         ret = hg.merge(repo, rev, wlock=wlock)
   330         ret = hg.merge(repo, rev, wlock=wlock)
   331         if ret:
   331         if ret:
   332             raise util.Abort(_("update returned %d") % ret)
   332             raise util.Abort(_("update returned %d") % ret)
   333         n = repo.commit(None, c[4], c[1], force=1, wlock=wlock)
   333         n = repo.commit(None, ctx.description(), ctx.user(),
       
   334                         force=1, wlock=wlock)
   334         if n == None:
   335         if n == None:
   335             raise util.Abort(_("repo commit failed"))
   336             raise util.Abort(_("repo commit failed"))
   336         try:
   337         try:
   337             message, comments, user, date, patchfound = mergeq.readheaders(patch)
   338             message, comments, user, date, patchfound = mergeq.readheaders(patch)
   338         except:
   339         except:
   610             name = os.path.join(backupdir, "%s" % revlog.short(rev))
   611             name = os.path.join(backupdir, "%s" % revlog.short(rev))
   611             name = savename(name)
   612             name = savename(name)
   612             self.ui.warn("saving bundle to %s\n" % name)
   613             self.ui.warn("saving bundle to %s\n" % name)
   613             return changegroup.writebundle(cg, name, "HG10BZ")
   614             return changegroup.writebundle(cg, name, "HG10BZ")
   614 
   615 
   615         def stripall(rev, revnum):
   616         def stripall(revnum):
   616             cl = repo.changelog
   617             mm = repo.changectx(rev).manifest()
   617             c = cl.read(rev)
       
   618             mm = repo.manifest.read(c[0])
       
   619             seen = {}
   618             seen = {}
   620 
   619 
   621             for x in xrange(revnum, cl.count()):
   620             for x in xrange(revnum, repo.changelog.count()):
   622                 c = cl.read(cl.node(x))
   621                 for f in repo.changectx(x).files():
   623                 for f in c[3]:
       
   624                     if f in seen:
   622                     if f in seen:
   625                         continue
   623                         continue
   626                     seen[f] = 1
   624                     seen[f] = 1
   627                     if f in mm:
   625                     if f in mm:
   628                         filerev = mm[f]
   626                         filerev = mm[f]
   700         if saveheads:
   698         if saveheads:
   701             backupch = repo.changegroupsubset(savebases.keys(), saveheads, 'strip')
   699             backupch = repo.changegroupsubset(savebases.keys(), saveheads, 'strip')
   702             chgrpfile = bundle(backupch)
   700             chgrpfile = bundle(backupch)
   703             chgrpfile = 'file:%s' % chgrpfile
   701             chgrpfile = 'file:%s' % chgrpfile
   704 
   702 
   705         stripall(rev, revnum)
   703         stripall(revnum)
   706 
   704 
   707         change = chlog.read(rev)
   705         change = chlog.read(rev)
   708         chlog.strip(revnum, revnum)
   706         chlog.strip(revnum, revnum)
   709         repo.manifest.strip(repo.manifest.rev(change[0]), revnum)
   707         repo.manifest.strip(repo.manifest.rev(change[0]), revnum)
   710         if saveheads:
   708         if saveheads: