Mercurial > hg
changeset 13484:14a699ed774b stable
i18n: merge with main
author | Martin Geisler <mg@aragost.com> |
---|---|
date | Wed, 23 Feb 2011 15:31:49 +0100 |
parents | 726492a96dd2 (current diff) 22f948c027a9 (diff) |
children | d8f31196a490 |
files | |
diffstat | 9 files changed, 158 insertions(+), 62 deletions(-) [+] |
line wrap: on
line diff
--- a/contrib/hgk Wed Feb 23 23:15:02 2011 +0900 +++ b/contrib/hgk Wed Feb 23 15:31:49 2011 +0100 @@ -276,6 +276,7 @@ set comdate {} set rev {} set branch {} + set bookmark {} if {![info exists nchildren($id)]} { set children($id) {} set nchildren($id) 0 @@ -314,7 +315,9 @@ set rev [lindex $line 1] } elseif {$tag == "branch"} { set branch [join [lrange $line 1 end]] - } + } elseif {$tag == "bookmark"} { + set bookmark [join [lrange $line 1 end]] + } } } else { if {$comment == {}} { @@ -338,7 +341,7 @@ set comdate [clock format $comdate -format "%Y-%m-%d %H:%M:%S"] } set commitinfo($id) [list $headline $auname $audate \ - $comname $comdate $comment $rev $branch] + $comname $comdate $comment $rev $branch $bookmark] if {[info exists firstparents]} { set i [lsearch $firstparents $id] @@ -369,7 +372,7 @@ } proc readrefs {} { - global tagids idtags headids idheads tagcontents env curid + global bookmarkcurrent bookmarkids tagids idtags idbookmarks headids idheads tagcontents env curid set status [catch {exec $env(HG) --config ui.report_untrusted=false id} curid] if { $status != 0 } { @@ -417,6 +420,28 @@ } } + set status [catch {exec $env(HG) --config ui.report_untrusted=false bookmarks} bookmarks] + if { $status != 0 } { + puts $::errorInfo + if { ![string equal $::errorCode NONE] } { + exit 2 + } + } + set lines [split $bookmarks "\n"] + set bookmarkcurrent 0 + foreach f $lines { + regexp {(\S+)$} $f full + regsub {\s+(\S+)$} $f "" direct + set sha [split $full ':'] + set bookmark [lindex $sha 1] + set current [string first " * " $direct)] + regsub {^\s(\*|\s)\s} $direct "" direct + lappend bookmarkids($direct) $bookmark + lappend idbookmarks($bookmark) $direct + if {$current >= 0} { + set bookmarkcurrent $direct + } + } } proc readotherrefs {base dname excl} { @@ -1042,7 +1067,7 @@ global canv canv2 canv3 mainfont namefont canvy linespc global lineid linehtag linentag linedtag commitinfo global colormap numcommits currentparents dupparents - global idtags idline idheads idotherrefs + global idtags idline idheads idotherrefs idbookmarks global lineno lthickness mainline mainlinearrow sidelines global commitlisted rowtextx idpos lastuse displist global oldnlines olddlevel olddisplist @@ -1100,7 +1125,7 @@ set rowtextx($lineno) $xt set idpos($id) [list $x $xt $y1] if {[info exists idtags($id)] || [info exists idheads($id)] - || [info exists idotherrefs($id)]} { + || [info exists idotherrefs($id)] || [info exists idbookmarks($id)]} { set xt [drawtags $id $x $xt $y1] } set headline [lindex $commitinfo($id) 0] @@ -1131,17 +1156,22 @@ } proc drawtags {id x xt y1} { - global idtags idheads idotherrefs commitinfo + global bookmarkcurrent idtags idbookmarks idheads idotherrefs commitinfo global linespc lthickness global canv mainfont idline rowtextx set marks {} + set nbookmarks 0 set ntags 0 set nheads 0 if {[info exists idtags($id)]} { set marks $idtags($id) set ntags [llength $marks] } + if {[info exists idbookmarks($id)]} { + set marks [concat $marks $idbookmarks($id)] + set nbookmarks [llength $idbookmarks($id)] + } if {[info exists idheads($id)]} { set headmark [lindex $commitinfo($id) 7] if {$headmark ne "default"} { @@ -1149,9 +1179,6 @@ set nheads 1 } } - if {[info exists idotherrefs($id)]} { - set marks [concat $marks $idotherrefs($id)] - } if {$marks eq {}} { return $xt } @@ -1180,16 +1207,25 @@ -width 1 -outline black -fill yellow -tags tag.$id] $canv bind $t <1> [list showtag $tag 1] set rowtextx($idline($id)) [expr {$xr + $linespc}] - } else { - # draw a head or other ref - if {[incr nheads -1] >= 0} { - set col green - } else { - set col "#ddddff" - } - set xl [expr $xl - $delta/2] - $canv create polygon $x $yt $xr $yt $xr $yb $x $yb \ - -width 1 -outline black -fill $col -tags tag.$id + } elseif {[incr nbookmarks -1] >= 0} { + # draw a tag + set col gray50 + if {[string compare $bookmarkcurrent $tag] == 0} { + set col gray + } + set xl [expr $xl - $delta/2] + $canv create polygon $x $yt $xr $yt $xr $yb $x $yb \ + -width 1 -outline black -fill $col -tags tag.$id + } else { + # draw a head or other ref + if {[incr nheads -1] >= 0} { + set col green + } else { + set col "#ddddff" + } + set xl [expr $xl - $delta/2] + $canv create polygon $x $yt $xr $yt $xr $yb $x $yb \ + -width 1 -outline black -fill $col -tags tag.$id } set t [$canv create text $xl $y1 -anchor w -text $tag \ -font $mainfont -tags tag.$id] @@ -2319,7 +2355,7 @@ global lineid linehtag linentag linedtag global canvy0 linespc parents nparents children global cflist currentid sha1entry - global commentend idtags idline linknum + global commentend idtags idbookmarks idline linknum $canv delete hover normalline @@ -2396,6 +2432,14 @@ } $ctext insert end "Author: [lindex $info 1] [lindex $info 2]\n" $ctext insert end "Committer: [lindex $info 3] [lindex $info 4]\n" + if {[info exists idbookmarks($id)]} { + $ctext insert end "Bookmarks:" + foreach bookmark $idbookmarks($id) { + $ctext insert end " $bookmark" + } + $ctext insert end "\n" + } + if {[info exists idtags($id)]} { $ctext insert end "Tags:" foreach tag $idtags($id) { @@ -3840,8 +3884,12 @@ } proc listrefs {id} { - global idtags idheads idotherrefs - + global idtags idheads idotherrefs idbookmarks + + set w {} + if {[info exists idbookmarks($id)]} { + set w $idbookmarks($id) + } set x {} if {[info exists idtags($id)]} { set x $idtags($id) @@ -3854,26 +3902,29 @@ if {[info exists idotherrefs($id)]} { set z $idotherrefs($id) } - return [list $x $y $z] + return [list $w $x $y $z] } proc rereadrefs {} { - global idtags idheads idotherrefs - global tagids headids otherrefids + global idbookmarks idtags idheads idotherrefs + global bookmarkids tagids headids otherrefids set refids [concat [array names idtags] \ - [array names idheads] [array names idotherrefs]] + [array names idheads] [array names idotherrefs] \ + [array names idbookmarks]] foreach id $refids { if {![info exists ref($id)]} { set ref($id) [listrefs $id] } } - foreach v {tagids idtags headids idheads otherrefids idotherrefs} { + foreach v {tagids idtags headids idheads otherrefids idotherrefs \ + bookmarkids idbookmarks} { catch {unset $v} } readrefs set refids [lsort -unique [concat $refids [array names idtags] \ - [array names idheads] [array names idotherrefs]]] + [array names idheads] [array names idotherrefs] \ + [array names idbookmarks]]] foreach id $refids { set v [listrefs $id] if {![info exists ref($id)] || $ref($id) != $v} {
--- a/mercurial/changegroup.py Wed Feb 23 23:15:02 2011 +0900 +++ b/mercurial/changegroup.py Wed Feb 23 15:31:49 2011 +0100 @@ -9,20 +9,24 @@ import util import struct, os, bz2, zlib, tempfile -def getchunk(source): - """return the next chunk from changegroup 'source' as a string""" - d = source.read(4) - if not d: - return "" +def readexactly(stream, n): + '''read n bytes from stream.read and abort if less was available''' + s = stream.read(n) + if len(s) < n: + raise util.Abort(_("stream ended unexpectedly" + " (got %d bytes, expected %d)") + % (len(s), n)) + return s + +def getchunk(stream): + """return the next chunk from stream as a string""" + d = readexactly(stream, 4) l = struct.unpack(">l", d)[0] if l <= 4: + if l: + raise util.Abort(_("invalid chunk length %d") % l) return "" - d = source.read(l - 4) - if len(d) < l - 4: - raise util.Abort(_("premature EOF reading chunk" - " (got %d bytes, expected %d)") - % (len(d), l - 4)) - return d + return readexactly(stream, l - 4) def chunkheader(length): """return a changegroup chunk header (string)""" @@ -147,31 +151,28 @@ return self._stream.close() def chunklength(self): - d = self.read(4) - if not d: + d = readexactly(self._stream, 4) + l = struct.unpack(">l", d)[0] + if l <= 4: + if l: + raise util.Abort(_("invalid chunk length %d") % l) return 0 - l = max(0, struct.unpack(">l", d)[0] - 4) - if l and self.callback: + if self.callback: self.callback() - return l + return l - 4 def chunk(self): """return the next chunk from changegroup 'source' as a string""" l = self.chunklength() - d = self.read(l) - if len(d) < l: - raise util.Abort(_("premature EOF reading chunk" - " (got %d bytes, expected %d)") - % (len(d), l)) - return d + return readexactly(self._stream, l) def parsechunk(self): l = self.chunklength() if not l: return {} - h = self.read(80) + h = readexactly(self._stream, 80) node, p1, p2, cs = struct.unpack("20s20s20s20s", h) - data = self.read(l - 80) + data = readexactly(self._stream, l - 80) return dict(node=node, p1=p1, p2=p2, cs=cs, data=data) class headerlessfixup(object): @@ -182,12 +183,12 @@ if self._h: d, self._h = self._h[:n], self._h[n:] if len(d) < n: - d += self._fh.read(n - len(d)) + d += readexactly(self._fh, n - len(d)) return d - return self._fh.read(n) + return readexactly(self._fh, n) def readbundle(fh, fname): - header = fh.read(6) + header = readexactly(fh, 6) if not fname: fname = "stream"
--- a/mercurial/commands.py Wed Feb 23 23:15:02 2011 +0900 +++ b/mercurial/commands.py Wed Feb 23 15:31:49 2011 +0100 @@ -2502,6 +2502,9 @@ source, branches = hg.parseurl(ui.expandpath(source), opts.get('branch')) other = hg.repository(hg.remoteui(repo, opts), source) + if 'bookmarks' not in other.listkeys('namespaces'): + ui.warn(_("remote doesn't support bookmarks\n")) + return 0 ui.status(_('comparing with %s\n') % url.hidepassword(source)) return bookmarks.diff(ui, repo, other) @@ -2786,6 +2789,9 @@ dest = ui.expandpath(dest or 'default-push', dest or 'default') dest, branches = hg.parseurl(dest, opts.get('branch')) other = hg.repository(hg.remoteui(repo, opts), dest) + if 'bookmarks' not in other.listkeys('namespaces'): + ui.warn(_("remote doesn't support bookmarks\n")) + return 0 ui.status(_('comparing with %s\n') % url.hidepassword(dest)) return bookmarks.diff(ui, other, repo) @@ -3699,6 +3705,8 @@ ui.write(_('parent: %d:%s ') % (p.rev(), str(p)), label='log.changeset') ui.write(' '.join(p.tags()), label='log.tag') + if p.bookmarks(): + ui.write(' ' + ' '.join(p.bookmarks()), label='log.bookmark') if p.rev() == -1: if not len(repo): ui.write(_(' (empty repository)')) @@ -3818,6 +3826,15 @@ o = repo.changelog.nodesbetween(o, None)[0] if o: t.append(_('%d outgoing') % len(o)) + if 'bookmarks' in other.listkeys('namespaces'): + lmarks = repo.listkeys('bookmarks') + rmarks = other.listkeys('bookmarks') + diff = set(rmarks) - set(lmarks) + if len(diff) > 0: + t.append(_('%d incoming bookmarks') % len(diff)) + diff = set(lmarks) - set(rmarks) + if len(diff) > 0: + t.append(_('%d outgoing bookmarks') % len(diff)) if t: ui.write(_('remote: %s\n') % (', '.join(t)))
--- a/mercurial/localrepo.py Wed Feb 23 23:15:02 2011 +0900 +++ b/mercurial/localrepo.py Wed Feb 23 15:31:49 2011 +0100 @@ -742,9 +742,13 @@ self.invalidate() self.dirstate.invalidate() self.destroyed() - self.ui.status(_("working directory now based on " - "revision %s\n") % ( - _(' and ').join(str(p.rev()) for p in self.parents()))) + parents = tuple([p.rev() for p in self.parents()]) + if len(parents) > 1: + self.ui.status(_("working directory now based on " + "revisions %d and %d\n") % parents) + else: + self.ui.status(_("working directory now based on " + "revision %d\n") % parents) else: self.ui.warn(_("no rollback information available\n")) return 1
--- a/mercurial/subrepo.py Wed Feb 23 23:15:02 2011 +0900 +++ b/mercurial/subrepo.py Wed Feb 23 15:31:49 2011 +0100 @@ -659,6 +659,7 @@ self._path = path self._relpath = os.path.join(reporelpath(ctx._repo), path) self._abspath = ctx._repo.wjoin(path) + self._subparent = ctx._repo self._ui = ctx._repo.ui def _gitcommand(self, commands, env=None, stream=False): @@ -751,10 +752,14 @@ (remote, ref.split('/', 2)[2])] = b return tracking + def _abssource(self, source): + self._subsource = source + return _abssource(self) + def _fetch(self, source, revision): if not os.path.exists(os.path.join(self._abspath, '.git')): self._ui.status(_('cloning subrepo %s\n') % self._relpath) - self._gitnodir(['clone', source, self._abspath]) + self._gitnodir(['clone', self._abssource(source), self._abspath]) if self._githavelocally(revision): return self._ui.status(_('pulling subrepo %s\n') % self._relpath) @@ -763,7 +768,7 @@ if self._githavelocally(revision): return # then try from known subrepo source - self._gitcommand(['fetch', source]) + self._gitcommand(['fetch', self._abssource(source)]) if not self._githavelocally(revision): raise util.Abort(_("revision %s does not exist in subrepo %s\n") % (revision, self._relpath))
--- a/tests/test-bookmarks.t Wed Feb 23 23:15:02 2011 +0900 +++ b/tests/test-bookmarks.t Wed Feb 23 15:31:49 2011 +0100 @@ -225,3 +225,12 @@ abort: bookmark 'foo:bar' contains illegal character [255] +test summary + + $ hg summary + parent: 2:db815d6d32e6 tip Y Z x y + 2 + branch: default + commit: (clean) + update: 1 new changesets, 2 branch heads (merge) +
--- a/tests/test-newbranch.t Wed Feb 23 23:15:02 2011 +0900 +++ b/tests/test-newbranch.t Wed Feb 23 15:31:49 2011 +0100 @@ -106,7 +106,7 @@ $ hg rollback repository tip rolled back to revision 4 (undo commit) - working directory now based on revision 4 and 3 + working directory now based on revisions 4 and 3 $ cp $branchcache .hg/bc-invalid
--- a/tests/test-rename-after-merge.t Wed Feb 23 23:15:02 2011 +0900 +++ b/tests/test-rename-after-merge.t Wed Feb 23 15:31:49 2011 +0100 @@ -98,7 +98,7 @@ $ hg rollback repository tip rolled back to revision 2 (undo commit) - working directory now based on revision 2 and 1 + working directory now based on revisions 2 and 1 $ hg up -C . 2 files updated, 0 files merged, 2 files removed, 0 files unresolved
--- a/tests/test-subrepo-git.t Wed Feb 23 23:15:02 2011 +0900 +++ b/tests/test-subrepo-git.t Wed Feb 23 15:31:49 2011 +0100 @@ -305,6 +305,15 @@ f g +relative source expansion + + $ cd .. + $ mkdir d + $ hg clone t d/t + updating to branch default + cloning subrepo s + 3 files updated, 0 files merged, 0 files removed, 0 files unresolved + Check hg update --clean $ cd $TESTTMP/ta $ echo > s/g