comparison hgext/mq.py @ 2838:851b07ec450c

mq: apply patch is any posative guard matches this is like guards command from quilt package.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Thu, 10 Aug 2006 17:18:55 -0700
parents 307439d6fede
children 82f50658c72b
comparison
equal deleted inserted replaced
2837:3b21013e7680 2838:851b07ec450c
174 guards = self.active() 174 guards = self.active()
175 exactneg = [g for g in patchguards if g[0] == '-' and g[1:] in guards] 175 exactneg = [g for g in patchguards if g[0] == '-' and g[1:] in guards]
176 if exactneg: 176 if exactneg:
177 return False, exactneg[0] 177 return False, exactneg[0]
178 pos = [g for g in patchguards if g[0] == '+'] 178 pos = [g for g in patchguards if g[0] == '+']
179 nonpos = [g for g in pos if g[1:] not in guards] 179 exactpos = [g for g in pos if g[1:] in guards]
180 if pos: 180 if pos:
181 if not nonpos: 181 if exactpos:
182 return True, '' 182 return True, exactpos[0]
183 return False, nonpos 183 return False, pos
184 return True, '' 184 return True, ''
185 185
186 def explain_pushable(self, idx, all_patches=False): 186 def explain_pushable(self, idx, all_patches=False):
187 write = all_patches and self.ui.write or self.ui.warn 187 write = all_patches and self.ui.write or self.ui.warn
188 if all_patches or self.ui.verbose: 188 if all_patches or self.ui.verbose:
1740 qguard bar.patch +stable (posative guard) 1740 qguard bar.patch +stable (posative guard)
1741 qselect stable 1741 qselect stable
1742 1742
1743 this sets "stable" guard. mq will skip foo.patch (because it has 1743 this sets "stable" guard. mq will skip foo.patch (because it has
1744 nagative match) but push bar.patch (because it has posative 1744 nagative match) but push bar.patch (because it has posative
1745 match). patch is pushed only if all posative guards match and no 1745 match). patch is pushed if any posative guards match and no
1746 nagative guards match. 1746 nagative guards match.
1747 1747
1748 with no arguments, default is to print current active guards. 1748 with no arguments, default is to print current active guards.
1749 with arguments, set active guards as given. 1749 with arguments, set active guards as given.
1750 1750