comparison hgext/mq.py @ 7627:fb32ae9c76e7

mq: lowercase output This extension produces quite a lot of informational messages during its normal operation and it is hard to say which strings can be changed and which cannot.
author Martin Geisler <mg@daimi.au.dk>
date Sat, 03 Jan 2009 17:15:21 +0100
parents 6d891df43a5f
children 1d54e2f6c0b7
comparison
equal deleted inserted replaced
7626:551afd4a4691 7627:fb32ae9c76e7
961 util.unlink(repo.wjoin(f)) 961 util.unlink(repo.wjoin(f))
962 self.ui.warn(_('done\n')) 962 self.ui.warn(_('done\n'))
963 raise 963 raise
964 top = self.applied[-1].name 964 top = self.applied[-1].name
965 if ret[0]: 965 if ret[0]:
966 self.ui.write(_("Errors during apply, please fix and " 966 self.ui.write(_("errors during apply, please fix and "
967 "refresh %s\n") % top) 967 "refresh %s\n") % top)
968 else: 968 else:
969 self.ui.write(_("Now at: %s\n") % top) 969 self.ui.write(_("now at: %s\n") % top)
970 return ret[0] 970 return ret[0]
971 finally: 971 finally:
972 del wlock 972 del wlock
973 973
974 def pop(self, repo, patch=None, force=False, update=True, all=False): 974 def pop(self, repo, patch=None, force=False, update=True, all=False):
1065 repo.dirstate.forget(f) 1065 repo.dirstate.forget(f)
1066 repo.dirstate.setparents(qp, revlog.nullid) 1066 repo.dirstate.setparents(qp, revlog.nullid)
1067 del self.applied[start:end] 1067 del self.applied[start:end]
1068 self.strip(repo, rev, update=False, backup='strip') 1068 self.strip(repo, rev, update=False, backup='strip')
1069 if len(self.applied): 1069 if len(self.applied):
1070 self.ui.write(_("Now at: %s\n") % self.applied[-1].name) 1070 self.ui.write(_("now at: %s\n") % self.applied[-1].name)
1071 else: 1071 else:
1072 self.ui.write(_("Patch queue now empty\n")) 1072 self.ui.write(_("patch queue now empty\n"))
1073 finally: 1073 finally:
1074 del wlock 1074 del wlock
1075 1075
1076 def diff(self, repo, pats, opts): 1076 def diff(self, repo, pats, opts):
1077 top = self.check_toppatch(repo) 1077 top = self.check_toppatch(repo)
1078 if not top: 1078 if not top:
1079 self.ui.write(_("No patches applied\n")) 1079 self.ui.write(_("no patches applied\n"))
1080 return 1080 return
1081 qp = self.qparents(repo, top) 1081 qp = self.qparents(repo, top)
1082 self._diffopts = patch.diffopts(self.ui, opts) 1082 self._diffopts = patch.diffopts(self.ui, opts)
1083 self.printdiff(repo, qp, files=pats, opts=opts) 1083 self.printdiff(repo, qp, files=pats, opts=opts)
1084 1084
1085 def refresh(self, repo, pats=None, **opts): 1085 def refresh(self, repo, pats=None, **opts):
1086 if len(self.applied) == 0: 1086 if len(self.applied) == 0:
1087 self.ui.write(_("No patches applied\n")) 1087 self.ui.write(_("no patches applied\n"))
1088 return 1 1088 return 1
1089 msg = opts.get('msg', '').rstrip() 1089 msg = opts.get('msg', '').rstrip()
1090 newuser = opts.get('user') 1090 newuser = opts.get('user')
1091 newdate = opts.get('date') 1091 newdate = opts.get('date')
1092 if newdate: 1092 if newdate:
1795 t = q.applied and q.series_end(True) or 0 1795 t = q.applied and q.series_end(True) or 0
1796 if t: 1796 if t:
1797 return q.qseries(repo, start=t-1, length=1, status='A', 1797 return q.qseries(repo, start=t-1, length=1, status='A',
1798 summary=opts.get('summary')) 1798 summary=opts.get('summary'))
1799 else: 1799 else:
1800 ui.write(_("No patches applied\n")) 1800 ui.write(_("no patches applied\n"))
1801 return 1 1801 return 1
1802 1802
1803 def next(ui, repo, **opts): 1803 def next(ui, repo, **opts):
1804 """print the name of the next patch""" 1804 """print the name of the next patch"""
1805 q = repo.mq 1805 q = repo.mq
1806 end = q.series_end() 1806 end = q.series_end()
1807 if end == len(q.series): 1807 if end == len(q.series):
1808 ui.write(_("All patches applied\n")) 1808 ui.write(_("all patches applied\n"))
1809 return 1 1809 return 1
1810 return q.qseries(repo, start=end, length=1, summary=opts.get('summary')) 1810 return q.qseries(repo, start=end, length=1, summary=opts.get('summary'))
1811 1811
1812 def prev(ui, repo, **opts): 1812 def prev(ui, repo, **opts):
1813 """print the name of the previous patch""" 1813 """print the name of the previous patch"""
1814 q = repo.mq 1814 q = repo.mq
1815 l = len(q.applied) 1815 l = len(q.applied)
1816 if l == 1: 1816 if l == 1:
1817 ui.write(_("Only one patch applied\n")) 1817 ui.write(_("only one patch applied\n"))
1818 return 1 1818 return 1
1819 if not l: 1819 if not l:
1820 ui.write(_("No patches applied\n")) 1820 ui.write(_("no patches applied\n"))
1821 return 1 1821 return 1
1822 return q.qseries(repo, start=l-2, length=1, status='A', 1822 return q.qseries(repo, start=l-2, length=1, status='A',
1823 summary=opts.get('summary')) 1823 summary=opts.get('summary'))
1824 1824
1825 def setupheaderopts(ui, opts): 1825 def setupheaderopts(ui, opts):
1879 """ 1879 """
1880 q = repo.mq 1880 q = repo.mq
1881 message = cmdutil.logmessage(opts) 1881 message = cmdutil.logmessage(opts)
1882 if opts['edit']: 1882 if opts['edit']:
1883 if not q.applied: 1883 if not q.applied:
1884 ui.write(_("No patches applied\n")) 1884 ui.write(_("no patches applied\n"))
1885 return 1 1885 return 1
1886 if message: 1886 if message:
1887 raise util.Abort(_('option "-e" incompatible with "-m" or "-l"')) 1887 raise util.Abort(_('option "-e" incompatible with "-m" or "-l"'))
1888 patch = q.applied[-1].name 1888 patch = q.applied[-1].name
1889 ph = q.readheaders(patch) 1889 ph = q.readheaders(patch)
2034 2034
2035 if patch: 2035 if patch:
2036 patch = q.lookup(patch) 2036 patch = q.lookup(patch)
2037 else: 2037 else:
2038 if not q.applied: 2038 if not q.applied:
2039 ui.write('No patches applied\n') 2039 ui.write('no patches applied\n')
2040 return 1 2040 return 1
2041 patch = q.lookup('qtip') 2041 patch = q.lookup('qtip')
2042 ph = repo.mq.readheaders(patch) 2042 ph = repo.mq.readheaders(patch)
2043 2043
2044 ui.write('\n'.join(ph.message) + '\n') 2044 ui.write('\n'.join(ph.message) + '\n')
2121 2121
2122 if patch: 2122 if patch:
2123 patch = q.lookup(patch) 2123 patch = q.lookup(patch)
2124 else: 2124 else:
2125 if not q.applied: 2125 if not q.applied:
2126 ui.write(_('No patches applied\n')) 2126 ui.write(_('no patches applied\n'))
2127 return 2127 return
2128 patch = q.lookup('qtip') 2128 patch = q.lookup('qtip')
2129 absdest = q.join(name) 2129 absdest = q.join(name)
2130 if os.path.isdir(absdest): 2130 if os.path.isdir(absdest):
2131 name = normname(os.path.join(name, os.path.basename(patch))) 2131 name = normname(os.path.join(name, os.path.basename(patch)))
2135 2135
2136 if name in q.series: 2136 if name in q.series:
2137 raise util.Abort(_('A patch named %s already exists in the series file') % name) 2137 raise util.Abort(_('A patch named %s already exists in the series file') % name)
2138 2138
2139 if ui.verbose: 2139 if ui.verbose:
2140 ui.write('Renaming %s to %s\n' % (patch, name)) 2140 ui.write('renaming %s to %s\n' % (patch, name))
2141 i = q.find_series(patch) 2141 i = q.find_series(patch)
2142 guards = q.guard_re.findall(q.full_series[i]) 2142 guards = q.guard_re.findall(q.full_series[i])
2143 q.full_series[i] = name + ''.join([' #' + g for g in guards]) 2143 q.full_series[i] = name + ''.join([' #' + g for g in guards])
2144 q.parse_series() 2144 q.parse_series()
2145 q.series_dirty = 1 2145 q.series_dirty = 1