Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/httprepo.py @ 1402:9d2c2e6b32b5
i18n part2: use '_' for all strings who are part of the user interface
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Tue, 18 Oct 2005 18:38:39 -0700 |
parents | cf9a1233738a |
children | 50de0887bbcd |
comparison
equal
deleted
inserted
replaced
1401:fbf2b10011aa | 1402:9d2c2e6b32b5 |
---|---|
66 | 66 |
67 def dev(self): | 67 def dev(self): |
68 return -1 | 68 return -1 |
69 | 69 |
70 def do_cmd(self, cmd, **args): | 70 def do_cmd(self, cmd, **args): |
71 self.ui.debug("sending %s command\n" % cmd) | 71 self.ui.debug(_("sending %s command\n") % cmd) |
72 q = {"cmd": cmd} | 72 q = {"cmd": cmd} |
73 q.update(args) | 73 q.update(args) |
74 qs = urllib.urlencode(q) | 74 qs = urllib.urlencode(q) |
75 cu = "%s?%s" % (self.url, qs) | 75 cu = "%s?%s" % (self.url, qs) |
76 resp = urllib2.urlopen(cu) | 76 resp = urllib2.urlopen(cu) |
78 | 78 |
79 # accept old "text/plain" and "application/hg-changegroup" for now | 79 # accept old "text/plain" and "application/hg-changegroup" for now |
80 if not proto.startswith('application/mercurial') and \ | 80 if not proto.startswith('application/mercurial') and \ |
81 not proto.startswith('text/plain') and \ | 81 not proto.startswith('text/plain') and \ |
82 not proto.startswith('application/hg-changegroup'): | 82 not proto.startswith('application/hg-changegroup'): |
83 raise hg.RepoError("'%s' does not appear to be an hg repository" % | 83 raise hg.RepoError(_("'%s' does not appear to be an hg repository") % |
84 self.url) | 84 self.url) |
85 | 85 |
86 if proto.startswith('application/mercurial'): | 86 if proto.startswith('application/mercurial'): |
87 version = proto[22:] | 87 version = proto[22:] |
88 if float(version) > 0.1: | 88 if float(version) > 0.1: |
89 raise hg.RepoError("'%s' uses newer protocol %s" % | 89 raise hg.RepoError(_("'%s' uses newer protocol %s") % |
90 (self.url, version)) | 90 (self.url, version)) |
91 | 91 |
92 return resp | 92 return resp |
93 | 93 |
94 def heads(self): | 94 def heads(self): |
95 d = self.do_cmd("heads").read() | 95 d = self.do_cmd("heads").read() |
96 try: | 96 try: |
97 return map(bin, d[:-1].split(" ")) | 97 return map(bin, d[:-1].split(" ")) |
98 except: | 98 except: |
99 self.ui.warn("unexpected response:\n" + d[:400] + "\n...\n") | 99 self.ui.warn(_("unexpected response:\n") + d[:400] + "\n...\n") |
100 raise | 100 raise |
101 | 101 |
102 def branches(self, nodes): | 102 def branches(self, nodes): |
103 n = " ".join(map(hex, nodes)) | 103 n = " ".join(map(hex, nodes)) |
104 d = self.do_cmd("branches", nodes=n).read() | 104 d = self.do_cmd("branches", nodes=n).read() |
105 try: | 105 try: |
106 br = [ tuple(map(bin, b.split(" "))) for b in d.splitlines() ] | 106 br = [ tuple(map(bin, b.split(" "))) for b in d.splitlines() ] |
107 return br | 107 return br |
108 except: | 108 except: |
109 self.ui.warn("unexpected response:\n" + d[:400] + "\n...\n") | 109 self.ui.warn(_("unexpected response:\n") + d[:400] + "\n...\n") |
110 raise | 110 raise |
111 | 111 |
112 def between(self, pairs): | 112 def between(self, pairs): |
113 n = "\n".join(["-".join(map(hex, p)) for p in pairs]) | 113 n = "\n".join(["-".join(map(hex, p)) for p in pairs]) |
114 d = self.do_cmd("between", pairs=n).read() | 114 d = self.do_cmd("between", pairs=n).read() |
115 try: | 115 try: |
116 p = [ l and map(bin, l.split(" ")) or [] for l in d.splitlines() ] | 116 p = [ l and map(bin, l.split(" ")) or [] for l in d.splitlines() ] |
117 return p | 117 return p |
118 except: | 118 except: |
119 self.ui.warn("unexpected response:\n" + d[:400] + "\n...\n") | 119 self.ui.warn(_("unexpected response:\n") + d[:400] + "\n...\n") |
120 raise | 120 raise |
121 | 121 |
122 def changegroup(self, nodes): | 122 def changegroup(self, nodes): |
123 n = " ".join(map(hex, nodes)) | 123 n = " ".join(map(hex, nodes)) |
124 f = self.do_cmd("changegroup", roots=n) | 124 f = self.do_cmd("changegroup", roots=n) |