# HG changeset patch # User Martin Geisler # Date 2011-03-13 12:05:16 # Node ID 2151703e7f844fb42864d49c853ea7cb284bbb9b # Parent 3f6a4579f803a41f637a9cf3992e0de5bd1205ec # Parent 1532ed1e50ca5d1a60fa09c31b9a6b5d1fbed82f merge with stable diff --git a/hgext/transplant.py b/hgext/transplant.py --- a/hgext/transplant.py +++ b/hgext/transplant.py @@ -453,8 +453,13 @@ def transplant(ui, repo, *revs, **opts): '''transplant changesets from another branch Selected changesets will be applied on top of the current working - directory with the log of the original changeset. If --log is - specified, log messages will have a comment appended of the form:: + directory with the log of the original changeset. The changesets + are copied and will thus appear twice in the history. Use the + rebase extension instead if you want to move a whole branch of + unpublished changesets. + + If --log is specified, log messages will have a comment appended + of the form:: (transplanted from CHANGESETHASH) @@ -469,9 +474,9 @@ def transplant(ui, repo, *revs, **opts): transplanted, otherwise you will be prompted to select the changesets you want. - :hg:`transplant --branch REVISION --all` will rebase the selected - branch (up to the named revision) onto your current working - directory. + :hg:`transplant --branch REVISION --all` will transplant the + selected branch (up to the named revision) onto your current + working directory. You can optionally mark selected transplanted changesets as merge changesets. You will not be prompted to transplant any ancestors diff --git a/mercurial/hgweb/request.py b/mercurial/hgweb/request.py --- a/mercurial/hgweb/request.py +++ b/mercurial/hgweb/request.py @@ -66,7 +66,7 @@ class wsgirequest(object): def drain(self): '''need to read all data from request, httplib is half-duplex''' - length = int(self.env.get('CONTENT_LENGTH', 0)) + length = int(self.env.get('CONTENT_LENGTH') or 0) for s in util.filechunkiter(self.inp, limit=length): pass diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py +++ b/mercurial/hgweb/webcommands.py @@ -21,8 +21,8 @@ from mercurial.i18n import _ __all__ = [ 'log', 'rawfile', 'file', 'changelog', 'shortlog', 'changeset', 'rev', - 'manifest', 'tags', 'branches', 'summary', 'filediff', 'diff', 'annotate', - 'filelog', 'archive', 'static', 'graph', 'help', + 'manifest', 'tags', 'bookmarks', 'branches', 'summary', 'filediff', 'diff', + 'annotate', 'filelog', 'archive', 'static', 'graph', 'help', ] def log(web, req, tmpl): @@ -205,6 +205,7 @@ def changelog(web, req, tmpl, shortlog=F "rev": i, "node": hex(n), "tags": webutil.nodetagsdict(web.repo, n), + "bookmarks": webutil.nodebookmarksdict(web.repo, n), "inbranch": webutil.nodeinbranch(web.repo, ctx), "branches": webutil.nodebranchdict(web.repo, ctx) }) @@ -247,6 +248,8 @@ def shortlog(web, req, tmpl): def changeset(web, req, tmpl): ctx = webutil.changectx(web.repo, req) showtags = webutil.showtag(web.repo, tmpl, 'changesettag', ctx.node()) + showbookmarks = webutil.showbookmark(web.repo, tmpl, 'changesetbookmark', + ctx.node()) showbranch = webutil.nodebranchnodefault(ctx) files = [] @@ -270,6 +273,7 @@ def changeset(web, req, tmpl): parent=webutil.parents(ctx), child=webutil.children(ctx), changesettag=showtags, + changesetbookmark=showbookmarks, changesetbranch=showbranch, author=ctx.user(), desc=ctx.description(), @@ -277,6 +281,7 @@ def changeset(web, req, tmpl): files=files, archives=web.archivelist(ctx.hex()), tags=webutil.nodetagsdict(web.repo, ctx.node()), + bookmarks=webutil.nodebookmarksdict(web.repo, ctx.node()), branch=webutil.nodebranchnodefault(ctx), inbranch=webutil.nodeinbranch(web.repo, ctx), branches=webutil.nodebranchdict(web.repo, ctx)) @@ -384,6 +389,30 @@ def tags(web, req, tmpl): entriesnotip=lambda **x: entries(True, 0, **x), latestentry=lambda **x: entries(True, 1, **x)) +def bookmarks(web, req, tmpl): + i = web.repo._bookmarks.items() + i.reverse() + parity = paritygen(web.stripecount) + + def entries(notip=False, limit=0, **map): + count = 0 + for k, n in i: + if notip and k == "tip": + continue + if limit > 0 and count >= limit: + continue + count = count + 1 + yield {"parity": parity.next(), + "bookmark": k, + "date": web.repo[n].date(), + "node": hex(n)} + + return tmpl("bookmarks", + node=hex(web.repo.changelog.tip()), + entries=lambda **x: entries(False, 0, **x), + entriesnotip=lambda **x: entries(True, 0, **x), + latestentry=lambda **x: entries(True, 1, **x)) + def branches(web, req, tmpl): tips = (web.repo[n] for t, n in web.repo.branchtags().iteritems()) heads = web.repo.heads() @@ -721,7 +750,8 @@ def graph(web, req, tmpl): user = cgi.escape(templatefilters.person(ctx.user())) branch = ctx.branch() branch = branch, web.repo.branchtags().get(branch) == ctx.node() - data.append((node, vtx, edges, desc, user, age, branch, ctx.tags())) + data.append((node, vtx, edges, desc, user, age, branch, ctx.tags(), + ctx.bookmarks())) return tmpl('graph', rev=rev, revcount=revcount, uprev=uprev, lessvars=lessvars, morevars=morevars, downrev=downrev, diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py --- a/mercurial/hgweb/webutil.py +++ b/mercurial/hgweb/webutil.py @@ -90,6 +90,9 @@ def renamelink(fctx): def nodetagsdict(repo, node): return [{"name": i} for i in repo.nodetags(node)] +def nodebookmarksdict(repo, node): + return [{"name": i} for i in repo.nodebookmarks(node)] + def nodebranchdict(repo, ctx): branches = [] branch = ctx.branch() @@ -118,6 +121,10 @@ def showtag(repo, tmpl, t1, node=nullid, for t in repo.nodetags(node): yield tmpl(t1, tag=t, **args) +def showbookmark(repo, tmpl, t1, node=nullid, **args): + for t in repo.nodebookmarks(node): + yield tmpl(t1, bookmark=t, **args) + def cleanpath(repo, path): path = path.lstrip('/') return util.canonpath(repo.root, '', path) diff --git a/mercurial/templates/paper/bookmarks.tmpl b/mercurial/templates/paper/bookmarks.tmpl new file mode 100644 --- /dev/null +++ b/mercurial/templates/paper/bookmarks.tmpl @@ -0,0 +1,49 @@ +{header} +{repo|escape}: bookmarks + + + + + +
+ + +
+

{repo|escape}

+

bookmarks

+ + + + + + + + +{entries%bookmarkentry} +
bookmarknode
+
+
+ +{footer} diff --git a/mercurial/templates/paper/branches.tmpl b/mercurial/templates/paper/branches.tmpl --- a/mercurial/templates/paper/branches.tmpl +++ b/mercurial/templates/paper/branches.tmpl @@ -17,6 +17,7 @@
  • log
  • graph
  • tags
  • +
  • bookmarks
  • branches
  • diff --git a/mercurial/templates/paper/fileannotate.tmpl b/mercurial/templates/paper/fileannotate.tmpl --- a/mercurial/templates/paper/fileannotate.tmpl +++ b/mercurial/templates/paper/fileannotate.tmpl @@ -13,6 +13,7 @@
  • log
  • graph
  • tags
  • +
  • bookmarks
  • branches
  • diff --git a/mercurial/templates/paper/filediff.tmpl b/mercurial/templates/paper/filediff.tmpl --- a/mercurial/templates/paper/filediff.tmpl +++ b/mercurial/templates/paper/filediff.tmpl @@ -13,6 +13,7 @@
  • log
  • graph
  • tags
  • +
  • bookmarks
  • branches
  • diff --git a/mercurial/templates/paper/shortlog.tmpl b/mercurial/templates/paper/shortlog.tmpl --- a/mercurial/templates/paper/shortlog.tmpl +++ b/mercurial/templates/paper/shortlog.tmpl @@ -17,6 +17,7 @@
  • log
  • graph
  • tags
  • +
  • bookmarks
  • branches
  • @@ -811,7 +815,7 @@ Overviews