comparison hgext/mq.py @ 20786:d666da075b91

mq: omit ".hgsubstate" from qnew/qrefresh target list for consistent node hash Before this patch, even if specified file patterns and -I/-X options cause listing ".hgsubstate" up in the target list, qnew/qrefresh put ".hgsubstate" into the target list individually and forcibly. This changes how many times ".hgsubstate" appear in the target list according to run-time conditions, and causes inconsistent node hash, even though revision content is same, because node hash calculation uses the specified target list directly (without duplication check or so). This patch always omits ".hgsubstate" from qnew/qrefresh target list for consistent node hash. This omitting doesn't miss including ".hgsubstate" changes, because: - "localrepository.commit()" puts ".hgsubstate" into the target list for "commitctx()" forcibly if needed - "mq.putsubstate2changes()" puts ".hgsubstate" into the target list for "patch.diff()" if it is not yet listed up
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Thu, 20 Mar 2014 00:10:45 +0900
parents 7f7c8ef31c5d
children 49f2d5644f04
comparison
equal deleted inserted replaced
20785:7f7c8ef31c5d 20786:d666da075b91
1033 diffopts = self.diffopts({'git': opts.get('git')}) 1033 diffopts = self.diffopts({'git': opts.get('git')})
1034 if opts.get('checkname', True): 1034 if opts.get('checkname', True):
1035 self.checkpatchname(patchfn) 1035 self.checkpatchname(patchfn)
1036 inclsubs = checksubstate(repo) 1036 inclsubs = checksubstate(repo)
1037 if inclsubs: 1037 if inclsubs:
1038 inclsubs.append('.hgsubstate')
1039 substatestate = repo.dirstate['.hgsubstate'] 1038 substatestate = repo.dirstate['.hgsubstate']
1040 if opts.get('include') or opts.get('exclude') or pats: 1039 if opts.get('include') or opts.get('exclude') or pats:
1041 match = scmutil.match(repo[None], pats, opts) 1040 match = scmutil.match(repo[None], pats, opts)
1042 # detect missing files in pats 1041 # detect missing files in pats
1043 def badfn(f, msg): 1042 def badfn(f, msg):
1044 if f != '.hgsubstate': # .hgsubstate is auto-created 1043 if f != '.hgsubstate': # .hgsubstate is auto-created
1045 raise util.Abort('%s: %s' % (f, msg)) 1044 raise util.Abort('%s: %s' % (f, msg))
1046 match.bad = badfn 1045 match.bad = badfn
1047 changes = repo.status(match=match) 1046 changes = repo.status(match=match)
1048 m, a, r, d = changes[:4]
1049 else: 1047 else:
1050 changes = self.checklocalchanges(repo, force=True) 1048 changes = self.checklocalchanges(repo, force=True)
1051 m, a, r, d = changes 1049 commitfiles = list(inclsubs)
1052 match = scmutil.matchfiles(repo, m + a + r + inclsubs) 1050 for files in changes[:3]:
1051 commitfiles.extend([f for f in files if f != '.hgsubstate'])
1052 match = scmutil.matchfiles(repo, commitfiles)
1053 if len(repo[None].parents()) > 1: 1053 if len(repo[None].parents()) > 1:
1054 raise util.Abort(_('cannot manage merge changesets')) 1054 raise util.Abort(_('cannot manage merge changesets'))
1055 commitfiles = m + a + r
1056 self.checktoppatch(repo) 1055 self.checktoppatch(repo)
1057 insert = self.fullseriesend() 1056 insert = self.fullseriesend()
1058 wlock = repo.wlock() 1057 wlock = repo.wlock()
1059 try: 1058 try:
1060 try: 1059 try:
1490 cparents = repo.changelog.parents(top) 1489 cparents = repo.changelog.parents(top)
1491 patchparent = self.qparents(repo, top) 1490 patchparent = self.qparents(repo, top)
1492 1491
1493 inclsubs = checksubstate(repo, hex(patchparent)) 1492 inclsubs = checksubstate(repo, hex(patchparent))
1494 if inclsubs: 1493 if inclsubs:
1495 inclsubs.append('.hgsubstate')
1496 substatestate = repo.dirstate['.hgsubstate'] 1494 substatestate = repo.dirstate['.hgsubstate']
1497 1495
1498 ph = patchheader(self.join(patchfn), self.plainmode) 1496 ph = patchheader(self.join(patchfn), self.plainmode)
1499 diffopts = self.diffopts({'git': opts.get('git')}, patchfn) 1497 diffopts = self.diffopts({'git': opts.get('git')}, patchfn)
1500 if msg: 1498 if msg:
1577 allmatches = set(cm + ca + cr + cd) 1575 allmatches = set(cm + ca + cr + cd)
1578 refreshchanges = [x.intersection(allmatches) for x in (mm, aa, dd)] 1576 refreshchanges = [x.intersection(allmatches) for x in (mm, aa, dd)]
1579 1577
1580 files = set(inclsubs) 1578 files = set(inclsubs)
1581 for x in refreshchanges: 1579 for x in refreshchanges:
1582 files.update(x) 1580 files.update([f for f in x if f != '.hgsubstate'])
1583 match = scmutil.matchfiles(repo, files) 1581 match = scmutil.matchfiles(repo, files)
1584 1582
1585 bmlist = repo[top].bookmarks() 1583 bmlist = repo[top].bookmarks()
1586 1584
1587 try: 1585 try: