comparison hgext/mq.py @ 7621:6d891df43a5f

mq: allow qpop if popped revisions are not working dir parents
author Dirkjan Ochtman <dirkjan@ochtman.nl>
date Mon, 12 Jan 2009 09:07:02 +0100
parents fbfd92d51540
children fb32ae9c76e7
comparison
equal deleted inserted replaced
7620:fbfd92d51540 7621:6d891df43a5f
1009 rr = [ revlog.bin(x.rev) for x in self.applied ] 1009 rr = [ revlog.bin(x.rev) for x in self.applied ]
1010 for p in parents: 1010 for p in parents:
1011 if p in rr: 1011 if p in rr:
1012 self.ui.warn(_("qpop: forcing dirstate update\n")) 1012 self.ui.warn(_("qpop: forcing dirstate update\n"))
1013 update = True 1013 update = True
1014 else:
1015 parents = [p.hex() for p in repo[None].parents()]
1016 needupdate = False
1017 for entry in self.applied[start:]:
1018 if entry.rev in parents:
1019 needupdate = True
1020 break
1021 update = needupdate
1014 1022
1015 if not force and update: 1023 if not force and update:
1016 self.check_localchanges(repo) 1024 self.check_localchanges(repo)
1017 1025
1018 self.applied_dirty = 1 1026 self.applied_dirty = 1
1019 end = len(self.applied) 1027 end = len(self.applied)
1020 rev = revlog.bin(self.applied[start].rev) 1028 rev = revlog.bin(self.applied[start].rev)
1021 if update: 1029 if update:
1022 top = self.check_toppatch(repo) 1030 top = self.check_toppatch(repo)
1023 1031
1024 if repo.changelog.heads(rev) != [revlog.bin(self.applied[-1].rev)]: 1032 try:
1033 heads = repo.changelog.heads(rev)
1034 except revlog.LookupError:
1035 node = short(rev)
1036 raise util.Abort(_('trying to pop unknown node %s') % node)
1037
1038 if heads != [revlog.bin(self.applied[-1].rev)]:
1025 raise util.Abort(_("popping would remove a revision not " 1039 raise util.Abort(_("popping would remove a revision not "
1026 "managed by this patch queue")) 1040 "managed by this patch queue"))
1027 1041
1028 # we know there are no local changes, so we can make a simplified 1042 # we know there are no local changes, so we can make a simplified
1029 # form of hg.update. 1043 # form of hg.update.