7 |
7 |
8 from node import bin, hex, nullid, nullrev, short |
8 from node import bin, hex, nullid, nullrev, short |
9 from i18n import _ |
9 from i18n import _ |
10 import repo, changegroup |
10 import repo, changegroup |
11 import changelog, dirstate, filelog, manifest, context, weakref |
11 import changelog, dirstate, filelog, manifest, context, weakref |
12 import lock, transaction, stat, errno, ui, store |
12 import lock, transaction, stat, errno, ui, store, encoding |
13 import os, time, util, extensions, hook, inspect, error |
13 import os, time, util, extensions, hook, inspect, error |
14 import match as match_ |
14 import match as match_ |
15 import merge as merge_ |
15 import merge as merge_ |
16 |
16 |
17 class localrepository(repo.repository): |
17 class localrepository(repo.repository): |
186 fp = self.wfile('.hgtags', 'wb') |
186 fp = self.wfile('.hgtags', 'wb') |
187 if prevtags: |
187 if prevtags: |
188 fp.write(prevtags) |
188 fp.write(prevtags) |
189 |
189 |
190 # committed tags are stored in UTF-8 |
190 # committed tags are stored in UTF-8 |
191 writetags(fp, names, util.fromlocal, prevtags) |
191 writetags(fp, names, encoding.fromlocal, prevtags) |
192 |
192 |
193 if use_dirstate and '.hgtags' not in self.dirstate: |
193 if use_dirstate and '.hgtags' not in self.dirstate: |
194 self.add(['.hgtags']) |
194 self.add(['.hgtags']) |
195 |
195 |
196 tagnode = self.commit(['.hgtags'], message, user, date, p1=parent, |
196 tagnode = self.commit(['.hgtags'], message, user, date, p1=parent, |
295 f = (f and f.filectx(fnode) or |
295 f = (f and f.filectx(fnode) or |
296 self.filectx('.hgtags', fileid=fnode)) |
296 self.filectx('.hgtags', fileid=fnode)) |
297 readtags(f.data().splitlines(), f, "global") |
297 readtags(f.data().splitlines(), f, "global") |
298 |
298 |
299 try: |
299 try: |
300 data = util.fromlocal(self.opener("localtags").read()) |
300 data = encoding.fromlocal(self.opener("localtags").read()) |
301 # localtags are stored in the local character set |
301 # localtags are stored in the local character set |
302 # while the internal tag table is stored in UTF-8 |
302 # while the internal tag table is stored in UTF-8 |
303 readtags(data.splitlines(), "localtags", "local") |
303 readtags(data.splitlines(), "localtags", "local") |
304 except IOError: |
304 except IOError: |
305 pass |
305 pass |
395 self._ubranchcache = partial |
395 self._ubranchcache = partial |
396 |
396 |
397 # the branch cache is stored on disk as UTF-8, but in the local |
397 # the branch cache is stored on disk as UTF-8, but in the local |
398 # charset internally |
398 # charset internally |
399 for k, v in partial.iteritems(): |
399 for k, v in partial.iteritems(): |
400 self.branchcache[util.tolocal(k)] = v |
400 self.branchcache[encoding.tolocal(k)] = v |
401 return self.branchcache |
401 return self.branchcache |
402 |
402 |
403 |
403 |
404 def branchtags(self): |
404 def branchtags(self): |
405 '''return a dict where branch names map to the tipmost head of |
405 '''return a dict where branch names map to the tipmost head of |
645 branch = self.opener("undo.branch").read() |
645 branch = self.opener("undo.branch").read() |
646 self.dirstate.setbranch(branch) |
646 self.dirstate.setbranch(branch) |
647 except IOError: |
647 except IOError: |
648 self.ui.warn(_("Named branch could not be reset, " |
648 self.ui.warn(_("Named branch could not be reset, " |
649 "current branch still is: %s\n") |
649 "current branch still is: %s\n") |
650 % util.tolocal(self.dirstate.branch())) |
650 % encoding.tolocal(self.dirstate.branch())) |
651 self.invalidate() |
651 self.invalidate() |
652 self.dirstate.invalidate() |
652 self.dirstate.invalidate() |
653 else: |
653 else: |
654 self.ui.warn(_("no rollback information available\n")) |
654 self.ui.warn(_("no rollback information available\n")) |
655 finally: |
655 finally: |
941 edittext.append("HG: --") |
941 edittext.append("HG: --") |
942 edittext.append("HG: user: %s" % user) |
942 edittext.append("HG: user: %s" % user) |
943 if p2 != nullid: |
943 if p2 != nullid: |
944 edittext.append("HG: branch merge") |
944 edittext.append("HG: branch merge") |
945 if branchname: |
945 if branchname: |
946 edittext.append("HG: branch '%s'" % util.tolocal(branchname)) |
946 edittext.append("HG: branch '%s'" |
|
947 % encoding.tolocal(branchname)) |
947 edittext.extend(["HG: added %s" % f for f in added]) |
948 edittext.extend(["HG: added %s" % f for f in added]) |
948 edittext.extend(["HG: changed %s" % f for f in updated]) |
949 edittext.extend(["HG: changed %s" % f for f in updated]) |
949 edittext.extend(["HG: removed %s" % f for f in removed]) |
950 edittext.extend(["HG: removed %s" % f for f in removed]) |
950 if not added and not updated and not removed: |
951 if not added and not updated and not removed: |
951 edittext.append("HG: no files changed") |
952 edittext.append("HG: no files changed") |