Show More
@@ -268,7 +268,7 b' class bugzilla(object):' | |||
|
268 | 268 | mapfile = self.ui.config('bugzilla', 'style') |
|
269 | 269 | tmpl = self.ui.config('bugzilla', 'template') |
|
270 | 270 | t = cmdutil.changeset_templater(self.ui, self.repo, |
|
271 |
False |
|
|
271 | False, mapfile, False) | |
|
272 | 272 | if not mapfile and not tmpl: |
|
273 | 273 | tmpl = _('changeset {node|short} in repo {root} refers ' |
|
274 | 274 | 'to bug {bug}.\ndetails:\n\t{desc|tabindent}') |
@@ -113,7 +113,7 b' class notifier(object):' | |||
|
113 | 113 | template = (self.ui.config('notify', hooktype) or |
|
114 | 114 | self.ui.config('notify', 'template')) |
|
115 | 115 | self.t = cmdutil.changeset_templater(self.ui, self.repo, |
|
116 |
False |
|
|
116 | False, mapfile, False) | |
|
117 | 117 | if not mapfile and not template: |
|
118 | 118 | template = deftemplates.get(hooktype) or single_template |
|
119 | 119 | if template: |
@@ -199,12 +199,11 b' def addremove(repo, pats=[], opts={}, wl' | |||
|
199 | 199 | class changeset_printer(object): |
|
200 | 200 | '''show changeset information when templating not requested.''' |
|
201 | 201 | |
|
202 |
def __init__(self, ui, repo, patch, |
|
|
202 | def __init__(self, ui, repo, patch, buffered): | |
|
203 | 203 | self.ui = ui |
|
204 | 204 | self.repo = repo |
|
205 | 205 | self.buffered = buffered |
|
206 | 206 | self.patch = patch |
|
207 | self.brinfo = brinfo | |
|
208 | 207 | self.header = {} |
|
209 | 208 | self.hunk = {} |
|
210 | 209 | self.lastheader = None |
@@ -268,11 +267,6 b' class changeset_printer(object):' | |||
|
268 | 267 | for parent in parents: |
|
269 | 268 | self.ui.write(_("parent: %d:%s\n") % parent) |
|
270 | 269 | |
|
271 | if self.brinfo: | |
|
272 | br = self.repo.branchlookup([changenode]) | |
|
273 | if br: | |
|
274 | self.ui.write(_("branch: %s\n") % " ".join(br[changenode])) | |
|
275 | ||
|
276 | 270 | if self.ui.debugflag: |
|
277 | 271 | self.ui.write(_("manifest: %d:%s\n") % |
|
278 | 272 | (self.repo.manifest.rev(changes[0]), hex(changes[0]))) |
@@ -320,8 +314,8 b' class changeset_printer(object):' | |||
|
320 | 314 | class changeset_templater(changeset_printer): |
|
321 | 315 | '''format changeset information.''' |
|
322 | 316 | |
|
323 |
def __init__(self, ui, repo, patch, |
|
|
324 |
changeset_printer.__init__(self, ui, repo, patch, |
|
|
317 | def __init__(self, ui, repo, patch, mapfile, buffered): | |
|
318 | changeset_printer.__init__(self, ui, repo, patch, buffered) | |
|
325 | 319 | self.t = templater.templater(mapfile, templater.common_filters, |
|
326 | 320 | cache={'parent': '{rev}:{node|short} ', |
|
327 | 321 | 'manifest': '{rev}:{node|short}', |
@@ -407,12 +401,6 b' class changeset_templater(changeset_prin' | |||
|
407 | 401 | if branch: |
|
408 | 402 | branch = util.tolocal(branch) |
|
409 | 403 | return showlist('branch', [branch], plural='branches', **args) |
|
410 | # add old style branches if requested | |
|
411 | if self.brinfo: | |
|
412 | br = self.repo.branchlookup([changenode]) | |
|
413 | if changenode in br: | |
|
414 | return showlist('branch', br[changenode], | |
|
415 | plural='branches', **args) | |
|
416 | 404 | |
|
417 | 405 | def showparents(**args): |
|
418 | 406 | parents = [[('rev', log.rev(p)), ('node', hex(p))] |
@@ -526,11 +514,6 b' def show_changeset(ui, repo, opts, buffe' | |||
|
526 | 514 | if opts.get('patch'): |
|
527 | 515 | patch = matchfn or util.always |
|
528 | 516 | |
|
529 | br = None | |
|
530 | if opts.get('branches'): | |
|
531 | ui.warn(_("the --branches option is deprecated, " | |
|
532 | "please use 'hg branches' instead\n")) | |
|
533 | br = True | |
|
534 | 517 | tmpl = opts.get('template') |
|
535 | 518 | mapfile = None |
|
536 | 519 | if tmpl: |
@@ -552,12 +535,12 b' def show_changeset(ui, repo, opts, buffe' | |||
|
552 | 535 | or templater.templatepath(mapfile)) |
|
553 | 536 | if mapname: mapfile = mapname |
|
554 | 537 | try: |
|
555 |
t = changeset_templater(ui, repo, patch, |
|
|
538 | t = changeset_templater(ui, repo, patch, mapfile, buffered) | |
|
556 | 539 | except SyntaxError, inst: |
|
557 | 540 | raise util.Abort(inst.args[0]) |
|
558 | 541 | if tmpl: t.use_template(tmpl) |
|
559 | 542 | return t |
|
560 |
return changeset_printer(ui, repo, patch, |
|
|
543 | return changeset_printer(ui, repo, patch, buffered) | |
|
561 | 544 | |
|
562 | 545 | def finddate(ui, repo, date): |
|
563 | 546 | """Find the tipmost changeset that matches the given date spec""" |
@@ -240,8 +240,7 b' def backout(ui, repo, rev, **opts):' | |||
|
240 | 240 | if op1 != node: |
|
241 | 241 | if opts['merge']: |
|
242 | 242 | ui.status(_('merging with changeset %s\n') % nice(op1)) |
|
243 |
|
|
|
244 | hg.merge(repo, n) | |
|
243 | hg.merge(repo, hex(op1)) | |
|
245 | 244 | else: |
|
246 | 245 | ui.status(_('the backout changeset is a new head - ' |
|
247 | 246 | 'do not forget to merge\n')) |
@@ -1698,7 +1697,6 b' def log(ui, repo, *pats, **opts):' | |||
|
1698 | 1697 | if opts["date"]: |
|
1699 | 1698 | df = util.matchdate(opts["date"]) |
|
1700 | 1699 | |
|
1701 | ||
|
1702 | 1700 | displayer = cmdutil.show_changeset(ui, repo, opts, True, matchfn) |
|
1703 | 1701 | for st, rev, fns in changeiter: |
|
1704 | 1702 | if st == 'add': |
@@ -1763,7 +1761,7 b' def manifest(ui, repo, rev=None):' | |||
|
1763 | 1761 | ui.write("%3s " % (m.execf(f) and "755" or "644")) |
|
1764 | 1762 | ui.write("%s\n" % f) |
|
1765 | 1763 | |
|
1766 |
def merge(ui, repo, node=None, force=None |
|
|
1764 | def merge(ui, repo, node=None, force=None): | |
|
1767 | 1765 | """Merge working directory with another revision |
|
1768 | 1766 | |
|
1769 | 1767 | Merge the contents of the current working directory and the |
@@ -1777,9 +1775,7 b' def merge(ui, repo, node=None, force=Non' | |||
|
1777 | 1775 | revision to merge with must be provided. |
|
1778 | 1776 | """ |
|
1779 | 1777 | |
|
1780 |
if node |
|
|
1781 | node = _lookup(repo, node, branch) | |
|
1782 | else: | |
|
1778 | if not node: | |
|
1783 | 1779 | heads = repo.heads() |
|
1784 | 1780 | if len(heads) > 2: |
|
1785 | 1781 | raise util.Abort(_('repo has %d heads - ' |
@@ -2478,7 +2474,7 b' def unbundle(ui, repo, fname, **opts):' | |||
|
2478 | 2474 | modheads = repo.addchangegroup(gen, 'unbundle', 'bundle:' + fname) |
|
2479 | 2475 | return postincoming(ui, repo, modheads, opts['update']) |
|
2480 | 2476 | |
|
2481 |
def update(ui, repo, node=None, clean=False, |
|
|
2477 | def update(ui, repo, node=None, clean=False, date=None): | |
|
2482 | 2478 | """update or merge working directory |
|
2483 | 2479 | |
|
2484 | 2480 | Update the working directory to the specified revision. |
@@ -2498,36 +2494,11 b' def update(ui, repo, node=None, clean=Fa' | |||
|
2498 | 2494 | raise util.Abort(_("you can't specify a revision and a date")) |
|
2499 | 2495 | node = cmdutil.finddate(ui, repo, date) |
|
2500 | 2496 | |
|
2501 | node = _lookup(repo, node, branch) | |
|
2502 | 2497 | if clean: |
|
2503 | 2498 | return hg.clean(repo, node) |
|
2504 | 2499 | else: |
|
2505 | 2500 | return hg.update(repo, node) |
|
2506 | 2501 | |
|
2507 | def _lookup(repo, node, branch=None): | |
|
2508 | if branch: | |
|
2509 | repo.ui.warn(_("the --branch option is deprecated, " | |
|
2510 | "please use 'hg branch' instead\n")) | |
|
2511 | br = repo.branchlookup(branch=branch) | |
|
2512 | found = [] | |
|
2513 | for x in br: | |
|
2514 | if branch in br[x]: | |
|
2515 | found.append(x) | |
|
2516 | if len(found) > 1: | |
|
2517 | repo.ui.warn(_("Found multiple heads for %s\n") % branch) | |
|
2518 | for x in found: | |
|
2519 | cmdutil.show_changeset(ui, repo, {}).show(changenode=x) | |
|
2520 | raise util.Abort("") | |
|
2521 | if len(found) == 1: | |
|
2522 | node = found[0] | |
|
2523 | repo.ui.warn(_("Using head %s for branch %s\n") | |
|
2524 | % (short(node), branch)) | |
|
2525 | else: | |
|
2526 | raise util.Abort(_("branch %s not found") % branch) | |
|
2527 | else: | |
|
2528 | node = node and repo.lookup(node) or repo.changelog.tip() | |
|
2529 | return node | |
|
2530 | ||
|
2531 | 2502 | def verify(ui, repo): |
|
2532 | 2503 | """verify the integrity of the repository |
|
2533 | 2504 | |
@@ -2733,8 +2704,7 b' table = {' | |||
|
2733 | 2704 | _('hg grep [OPTION]... PATTERN [FILE]...')), |
|
2734 | 2705 | "heads": |
|
2735 | 2706 | (heads, |
|
2736 | [('b', 'branches', None, _('show branches (DEPRECATED)')), | |
|
2737 | ('', 'style', '', _('display using template map file')), | |
|
2707 | [('', 'style', '', _('display using template map file')), | |
|
2738 | 2708 | ('r', 'rev', '', _('show only heads which are descendants of rev')), |
|
2739 | 2709 | ('', 'template', '', _('display with template'))], |
|
2740 | 2710 | _('hg heads [-r REV]')), |
@@ -2745,7 +2715,7 b' table = {' | |||
|
2745 | 2715 | [('p', 'strip', 1, |
|
2746 | 2716 | _('directory strip option for patch. This has the same\n' |
|
2747 | 2717 | 'meaning as the corresponding patch option')), |
|
2748 |
('b', 'base', '', _('base path |
|
|
2718 | ('b', 'base', '', _('base path')), | |
|
2749 | 2719 | ('f', 'force', None, |
|
2750 | 2720 | _('skip check for outstanding uncommitted changes'))] + commitopts, |
|
2751 | 2721 | _('hg import [-p NUM] [-m MESSAGE] [-f] PATCH...')), |
@@ -2775,8 +2745,7 b' table = {' | |||
|
2775 | 2745 | _('hg locate [OPTION]... [PATTERN]...')), |
|
2776 | 2746 | "^log|history": |
|
2777 | 2747 | (log, |
|
2778 | [('b', 'branches', None, _('show branches (DEPRECATED)')), | |
|
2779 | ('f', 'follow', None, | |
|
2748 | [('f', 'follow', None, | |
|
2780 | 2749 | _('follow changeset history, or file history across copies and renames')), |
|
2781 | 2750 | ('', 'follow-first', None, |
|
2782 | 2751 | _('only follow the first parent of merge changesets')), |
@@ -2797,8 +2766,7 b' table = {' | |||
|
2797 | 2766 | "manifest": (manifest, [], _('hg manifest [REV]')), |
|
2798 | 2767 | "merge": |
|
2799 | 2768 | (merge, |
|
2800 | [('b', 'branch', '', _('merge with head of a specific branch (DEPRECATED)')), | |
|
2801 | ('f', 'force', None, _('force a merge with outstanding changes'))], | |
|
2769 | [('f', 'force', None, _('force a merge with outstanding changes'))], | |
|
2802 | 2770 | _('hg merge [-f] [REV]')), |
|
2803 | 2771 | "outgoing|out": (outgoing, |
|
2804 | 2772 | [('M', 'no-merges', None, _('do not show merges')), |
@@ -2813,8 +2781,7 b' table = {' | |||
|
2813 | 2781 | _('hg outgoing [-M] [-p] [-n] [-r REV]... [DEST]')), |
|
2814 | 2782 | "^parents": |
|
2815 | 2783 | (parents, |
|
2816 |
[(' |
|
|
2817 | ('r', 'rev', '', _('show parents from the specified rev')), | |
|
2784 | [('r', 'rev', '', _('show parents from the specified rev')), | |
|
2818 | 2785 | ('', 'style', '', _('display using template map file')), |
|
2819 | 2786 | ('', 'template', '', _('display with template'))], |
|
2820 | 2787 | _('hg parents [-r REV] [FILE]')), |
@@ -2916,8 +2883,7 b' table = {' | |||
|
2916 | 2883 | "tags": (tags, [], _('hg tags')), |
|
2917 | 2884 | "tip": |
|
2918 | 2885 | (tip, |
|
2919 | [('b', 'branches', None, _('show branches (DEPRECATED)')), | |
|
2920 | ('', 'style', '', _('display using template map file')), | |
|
2886 | [('', 'style', '', _('display using template map file')), | |
|
2921 | 2887 | ('p', 'patch', None, _('show patch')), |
|
2922 | 2888 | ('', 'template', '', _('display with template'))], |
|
2923 | 2889 | _('hg tip [-p]')), |
@@ -2928,9 +2894,7 b' table = {' | |||
|
2928 | 2894 | _('hg unbundle [-u] FILE')), |
|
2929 | 2895 | "^update|up|checkout|co": |
|
2930 | 2896 | (update, |
|
2931 | [('b', 'branch', '', | |
|
2932 | _('checkout the head of a specific branch (DEPRECATED)')), | |
|
2933 | ('C', 'clean', None, _('overwrite locally modified files')), | |
|
2897 | [('C', 'clean', None, _('overwrite locally modified files')), | |
|
2934 | 2898 | ('d', 'date', '', _('tipmost revision matching date'))], |
|
2935 | 2899 | _('hg update [-C] [REV]')), |
|
2936 | 2900 | "verify": (verify, [], _('hg verify')), |
@@ -993,112 +993,6 b' class localrepository(repo.repository):' | |||
|
993 | 993 | heads.sort() |
|
994 | 994 | return [n for (r, n) in heads] |
|
995 | 995 | |
|
996 | # branchlookup returns a dict giving a list of branches for | |
|
997 | # each head. A branch is defined as the tag of a node or | |
|
998 | # the branch of the node's parents. If a node has multiple | |
|
999 | # branch tags, tags are eliminated if they are visible from other | |
|
1000 | # branch tags. | |
|
1001 | # | |
|
1002 | # So, for this graph: a->b->c->d->e | |
|
1003 | # \ / | |
|
1004 | # aa -----/ | |
|
1005 | # a has tag 2.6.12 | |
|
1006 | # d has tag 2.6.13 | |
|
1007 | # e would have branch tags for 2.6.12 and 2.6.13. Because the node | |
|
1008 | # for 2.6.12 can be reached from the node 2.6.13, that is eliminated | |
|
1009 | # from the list. | |
|
1010 | # | |
|
1011 | # It is possible that more than one head will have the same branch tag. | |
|
1012 | # callers need to check the result for multiple heads under the same | |
|
1013 | # branch tag if that is a problem for them (ie checkout of a specific | |
|
1014 | # branch). | |
|
1015 | # | |
|
1016 | # passing in a specific branch will limit the depth of the search | |
|
1017 | # through the parents. It won't limit the branches returned in the | |
|
1018 | # result though. | |
|
1019 | def branchlookup(self, heads=None, branch=None): | |
|
1020 | if not heads: | |
|
1021 | heads = self.heads() | |
|
1022 | headt = [ h for h in heads ] | |
|
1023 | chlog = self.changelog | |
|
1024 | branches = {} | |
|
1025 | merges = [] | |
|
1026 | seenmerge = {} | |
|
1027 | ||
|
1028 | # traverse the tree once for each head, recording in the branches | |
|
1029 | # dict which tags are visible from this head. The branches | |
|
1030 | # dict also records which tags are visible from each tag | |
|
1031 | # while we traverse. | |
|
1032 | while headt or merges: | |
|
1033 | if merges: | |
|
1034 | n, found = merges.pop() | |
|
1035 | visit = [n] | |
|
1036 | else: | |
|
1037 | h = headt.pop() | |
|
1038 | visit = [h] | |
|
1039 | found = [h] | |
|
1040 | seen = {} | |
|
1041 | while visit: | |
|
1042 | n = visit.pop() | |
|
1043 | if n in seen: | |
|
1044 | continue | |
|
1045 | pp = chlog.parents(n) | |
|
1046 | tags = self.nodetags(n) | |
|
1047 | if tags: | |
|
1048 | for x in tags: | |
|
1049 | if x == 'tip': | |
|
1050 | continue | |
|
1051 | for f in found: | |
|
1052 | branches.setdefault(f, {})[n] = 1 | |
|
1053 | branches.setdefault(n, {})[n] = 1 | |
|
1054 | break | |
|
1055 | if n not in found: | |
|
1056 | found.append(n) | |
|
1057 | if branch in tags: | |
|
1058 | continue | |
|
1059 | seen[n] = 1 | |
|
1060 | if pp[1] != nullid and n not in seenmerge: | |
|
1061 | merges.append((pp[1], [x for x in found])) | |
|
1062 | seenmerge[n] = 1 | |
|
1063 | if pp[0] != nullid: | |
|
1064 | visit.append(pp[0]) | |
|
1065 | # traverse the branches dict, eliminating branch tags from each | |
|
1066 | # head that are visible from another branch tag for that head. | |
|
1067 | out = {} | |
|
1068 | viscache = {} | |
|
1069 | for h in heads: | |
|
1070 | def visible(node): | |
|
1071 | if node in viscache: | |
|
1072 | return viscache[node] | |
|
1073 | ret = {} | |
|
1074 | visit = [node] | |
|
1075 | while visit: | |
|
1076 | x = visit.pop() | |
|
1077 | if x in viscache: | |
|
1078 | ret.update(viscache[x]) | |
|
1079 | elif x not in ret: | |
|
1080 | ret[x] = 1 | |
|
1081 | if x in branches: | |
|
1082 | visit[len(visit):] = branches[x].keys() | |
|
1083 | viscache[node] = ret | |
|
1084 | return ret | |
|
1085 | if h not in branches: | |
|
1086 | continue | |
|
1087 | # O(n^2), but somewhat limited. This only searches the | |
|
1088 | # tags visible from a specific head, not all the tags in the | |
|
1089 | # whole repo. | |
|
1090 | for b in branches[h]: | |
|
1091 | vis = False | |
|
1092 | for bb in branches[h].keys(): | |
|
1093 | if b != bb: | |
|
1094 | if b in visible(bb): | |
|
1095 | vis = True | |
|
1096 | break | |
|
1097 | if not vis: | |
|
1098 | l = out.setdefault(h, []) | |
|
1099 | l[len(l):] = self.nodetags(b) | |
|
1100 | return out | |
|
1101 | ||
|
1102 | 996 | def branches(self, nodes): |
|
1103 | 997 | if not nodes: |
|
1104 | 998 | nodes = [self.changelog.tip()] |
@@ -441,6 +441,9 b' def update(repo, node, branchmerge, forc' | |||
|
441 | 441 | wlock = working dir lock, if already held |
|
442 | 442 | """ |
|
443 | 443 | |
|
444 | if node is None: | |
|
445 | node = "tip" | |
|
446 | ||
|
444 | 447 | if not wlock: |
|
445 | 448 | wlock = repo.wlock() |
|
446 | 449 |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now