# HG changeset patch # User Matt Mackall # Date 1165611939 21600 # Node ID 4e488ccc8120f8ec09e1707e4d384518385b3208 # Parent 531c116b20289ab0bb280fe13cf484763abb30a4# Parent ed5a9b27bedc99acb4fe5acf76186e2fa631131a Merge with crew diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -2043,13 +2043,10 @@ def reposetup(ui, repo): return tagscache - def branchtags(self): - if self.branchcache != None: - return self.branchcache - + def _branchtags(self): q = self.mq if not q.applied: - return super(mqrepo, self).branchtags() + return super(mqrepo, self)._branchtags() self.branchcache = {} # avoid recursion in changectx cl = self.changelog @@ -2069,8 +2066,7 @@ def reposetup(ui, repo): # update the cache up to the tip self._updatebranchcache(partial, start, cl.count()) - self.branchcache = partial - return self.branchcache + return partial if repo.local(): repo.__class__ = mqrepo diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py --- a/mercurial/cmdutil.py +++ b/mercurial/cmdutil.py @@ -18,7 +18,7 @@ def revpair(repo, revs): be None, meaning use working dir.''' def revfix(repo, val, defval): - if not val and val != 0: + if not val and val != 0 and defval is not None: val = defval return repo.lookup(val) @@ -261,6 +261,7 @@ class changeset_printer(object): self.ui.write(_("changeset: %d:%s\n") % (rev, hexfunc(changenode))) if branch: + branch = util.tolocal(branch) self.ui.write(_("branch: %s\n") % branch) for tag in self.repo.nodetags(changenode): self.ui.write(_("tag: %s\n") % tag) @@ -404,6 +405,7 @@ class changeset_templater(changeset_prin def showbranches(**args): branch = changes[5].get("branch") if branch: + branch = util.tolocal(branch) return showlist('branch', [branch], plural='branches', **args) # add old style branches if requested if self.brinfo: diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -2437,10 +2437,7 @@ walkopts = [ ] table = { - "^add": - (add, - walkopts + dryrunopts, - _('hg add [OPTION]... [FILE]...')), + "^add": (add, walkopts + dryrunopts, _('hg add [OPTION]... [FILE]...')), "addremove": (addremove, [('s', 'similarity', '', @@ -2534,15 +2531,15 @@ table = { "debugcheckstate": (debugcheckstate, [], _('debugcheckstate')), "debugsetparents": (debugsetparents, [], _('debugsetparents REV1 [REV2]')), "debugstate": (debugstate, [], _('debugstate')), - "debugdate": (debugdate, - [('e','extended', None, _('try extended date formats'))], - _('debugdata [-e] DATE [RANGE]')), + "debugdate": + (debugdate, + [('e', 'extended', None, _('try extended date formats'))], + _('debugdate [-e] DATE [RANGE]')), "debugdata": (debugdata, [], _('debugdata FILE REV')), "debugindex": (debugindex, [], _('debugindex FILE')), "debugindexdot": (debugindexdot, [], _('debugindexdot FILE')), "debugrename": (debugrename, [], _('debugrename FILE [REV]')), - "debugwalk": - (debugwalk, walkopts, _('debugwalk [OPTION]... [FILE]...')), + "debugwalk": (debugwalk, walkopts, _('debugwalk [OPTION]... [FILE]...')), "^diff": (diff, [('r', 'rev', [], _('revision')), diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -312,12 +312,7 @@ class localrepository(repo.repository): self.nodetagscache.setdefault(n, []).append(t) return self.nodetagscache.get(node, []) - def branchtags(self): - if self.branchcache != None: - return self.branchcache - - self.branchcache = {} # avoid recursion in changectx - + def _branchtags(self): partial, last, lrev = self._readbranchcache() tiprev = self.changelog.count() - 1 @@ -325,6 +320,15 @@ class localrepository(repo.repository): self._updatebranchcache(partial, lrev+1, tiprev+1) self._writebranchcache(partial, self.changelog.tip(), tiprev) + return partial + + def branchtags(self): + if self.branchcache is not None: + return self.branchcache + + self.branchcache = {} # avoid recursion in changectx + partial = self._branchtags() + # the branch cache is stored on disk as UTF-8, but in the local # charset internally for k, v in partial.items(): diff --git a/tests/test-diffdir b/tests/test-diffdir --- a/tests/test-diffdir +++ b/tests/test-diffdir @@ -13,3 +13,8 @@ hg diff --nodates -r tip echo foo > a hg diff --nodates + +hg diff -r "" +hg diff -r tip -r "" + +true diff --git a/tests/test-diffdir.out b/tests/test-diffdir.out --- a/tests/test-diffdir.out +++ b/tests/test-diffdir.out @@ -18,3 +18,5 @@ diff -r acd8075edac9 b +++ b/b @@ -0,0 +1,1 @@ +123 +abort: Ambiguous identifier! +abort: Ambiguous identifier! diff --git a/tests/test-encoding b/tests/test-encoding --- a/tests/test-encoding +++ b/tests/test-encoding @@ -25,6 +25,9 @@ echo "utf-8" > a HGENCODING=utf-8 hg ci -l utf-8 -d "0 0" HGENCODING=latin-1 hg tag -d "0 0" `cat latin-1-tag` +cp latin-1-tag .hg/branch +HGENCODING=latin-1 hg ci -d "0 0" -m 'latin1 branch' +rm .hg/branch echo % ascii hg --encoding ascii log @@ -38,3 +41,9 @@ echo % latin-1 HGENCODING=latin-1 hg tags echo % utf-8 HGENCODING=utf-8 hg tags +echo % ascii +HGENCODING=ascii hg branches +echo % latin-1 +HGENCODING=latin-1 hg branches +echo % utf-8 +HGENCODING=utf-8 hg branches diff --git a/tests/test-encoding.out b/tests/test-encoding.out --- a/tests/test-encoding.out +++ b/tests/test-encoding.out @@ -15,8 +15,14 @@ transaction abort! rollback completed % these should work % ascii +changeset: 4:d8a5d9eaf41e +branch: ? +tag: tip +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: latin1 branch + changeset: 3:5edfc7acb541 -tag: tip user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: Added tag ? for changeset 91878608adb3 @@ -38,8 +44,14 @@ date: Thu Jan 01 00:00:00 1970 +0 summary: latin-1 e': ? % latin-1 +changeset: 4:d8a5d9eaf41e +branch: é +tag: tip +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: latin1 branch + changeset: 3:5edfc7acb541 -tag: tip user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: Added tag é for changeset 91878608adb3 @@ -61,8 +73,14 @@ date: Thu Jan 01 00:00:00 1970 +0 summary: latin-1 e': é % utf-8 +changeset: 4:d8a5d9eaf41e +branch: é +tag: tip +user: test +date: Thu Jan 01 00:00:00 1970 +0000 +summary: latin1 branch + changeset: 3:5edfc7acb541 -tag: tip user: test date: Thu Jan 01 00:00:00 1970 +0000 summary: Added tag é for changeset 91878608adb3 @@ -84,11 +102,17 @@ date: Thu Jan 01 00:00:00 1970 +0 summary: latin-1 e': é % ascii -tip 3:5edfc7acb541 +tip 4:d8a5d9eaf41e ? 2:91878608adb3 % latin-1 -tip 3:5edfc7acb541 +tip 4:d8a5d9eaf41e é 2:91878608adb3 % utf-8 -tip 3:5edfc7acb541 +tip 4:d8a5d9eaf41e é 2:91878608adb3 +% ascii +? 4:d8a5d9eaf41e +% latin-1 +é 4:d8a5d9eaf41e +% utf-8 +é 4:d8a5d9eaf41e