Show More
@@ -107,6 +107,7 b' def patchbomb(ui, repo, *revs, **opts):' | |||||
107 | def makepatch(patch, idx, total): |
|
107 | def makepatch(patch, idx, total): | |
108 | desc = [] |
|
108 | desc = [] | |
109 | node = None |
|
109 | node = None | |
|
110 | body = '' | |||
110 | for line in patch: |
|
111 | for line in patch: | |
111 | if line.startswith('#'): |
|
112 | if line.startswith('#'): | |
112 | if line.startswith('# Node ID'): node = line.split()[-1] |
|
113 | if line.startswith('# Node ID'): node = line.split()[-1] | |
@@ -191,8 +192,9 b' def patchbomb(ui, repo, *revs, **opts):' | |||||
191 |
|
192 | |||
192 | ui.write('\n') |
|
193 | ui.write('\n') | |
193 |
|
194 | |||
194 | d = cdiffstat('Final summary:\n', jumbo) |
|
195 | if opts['diffstat']: | |
195 | if d: msg.attach(MIMEText(d)) |
|
196 | d = cdiffstat('Final summary:\n', jumbo) | |
|
197 | if d: msg.attach(MIMEText(d)) | |||
196 |
|
198 | |||
197 | msgs.insert(0, msg) |
|
199 | msgs.insert(0, msg) | |
198 |
|
200 |
@@ -13,5 +13,8 b' from mercurial import hgweb' | |||||
13 | # virtual/path = /real/path |
|
13 | # virtual/path = /real/path | |
14 | # virtual/path = /real/path |
|
14 | # virtual/path = /real/path | |
15 |
|
15 | |||
|
16 | # Alternatively you can pass a list of ('virtual/path', '/real/path') tuples | |||
|
17 | # or use a dictionary with entries like 'virtual/path': '/real/path' | |||
|
18 | ||||
16 | h = hgweb.hgwebdir("hgweb.config") |
|
19 | h = hgweb.hgwebdir("hgweb.config") | |
17 | h.run() |
|
20 | h.run() |
@@ -297,20 +297,12 b' def dodiff(fp, ui, repo, node1, node2, f' | |||||
297 | tn = None |
|
297 | tn = None | |
298 | fp.write(mdiff.unidiff(to, date1, tn, date2, f, r, text=text)) |
|
298 | fp.write(mdiff.unidiff(to, date1, tn, date2, f, r, text=text)) | |
299 |
|
299 | |||
300 |
def trimuser(ui, |
|
300 | def trimuser(ui, name, rev, revcache): | |
301 | """trim the name of the user who committed a change""" |
|
301 | """trim the name of the user who committed a change""" | |
302 | try: |
|
302 | user = revcache.get(rev) | |
303 | return revcache[rev] |
|
303 | if user is None: | |
304 | except KeyError: |
|
304 | user = revcache[rev] = ui.shortuser(name) | |
305 | if not ui.verbose: |
|
305 | return user | |
306 | f = name.find('@') |
|
|||
307 | if f >= 0: |
|
|||
308 | name = name[:f] |
|
|||
309 | f = name.find('<') |
|
|||
310 | if f >= 0: |
|
|||
311 | name = name[f+1:] |
|
|||
312 | revcache[rev] = name |
|
|||
313 | return name |
|
|||
314 |
|
306 | |||
315 | def show_changeset(ui, repo, rev=0, changenode=None, brinfo=None): |
|
307 | def show_changeset(ui, repo, rev=0, changenode=None, brinfo=None): | |
316 | """show a single changeset or file revision""" |
|
308 | """show a single changeset or file revision""" | |
@@ -517,7 +509,7 b' def annotate(ui, repo, *pats, **opts):' | |||||
517 | ucache = {} |
|
509 | ucache = {} | |
518 | def getname(rev): |
|
510 | def getname(rev): | |
519 | cl = repo.changelog.read(repo.changelog.node(rev)) |
|
511 | cl = repo.changelog.read(repo.changelog.node(rev)) | |
520 |
return trimuser(ui, |
|
512 | return trimuser(ui, cl[1], rev, ucache) | |
521 |
|
513 | |||
522 | if not pats: |
|
514 | if not pats: | |
523 | raise util.Abort('at least one file name or pattern required') |
|
515 | raise util.Abort('at least one file name or pattern required') | |
@@ -630,8 +622,8 b' def clone(ui, source, dest=None, **opts)' | |||||
630 | repo = hg.repository(ui, dest, create=1) |
|
622 | repo = hg.repository(ui, dest, create=1) | |
631 | repo.pull(other) |
|
623 | repo.pull(other) | |
632 |
|
624 | |||
633 |
f = repo.opener("hgrc", " |
|
625 | f = repo.opener("hgrc", "a") | |
634 | f.write("[paths]\n") |
|
626 | f.write("\n[paths]\n") | |
635 | f.write("default = %s\n" % abspath) |
|
627 | f.write("default = %s\n" % abspath) | |
636 |
|
628 | |||
637 | if not opts['noupdate']: |
|
629 | if not opts['noupdate']: | |
@@ -726,9 +718,8 b' def debugstate(ui, repo):' | |||||
726 | % (dc[file_][0], dc[file_][1] & 0777, dc[file_][2], |
|
718 | % (dc[file_][0], dc[file_][1] & 0777, dc[file_][2], | |
727 | time.strftime("%x %X", |
|
719 | time.strftime("%x %X", | |
728 | time.localtime(dc[file_][3])), file_)) |
|
720 | time.localtime(dc[file_][3])), file_)) | |
729 | ui.write("\n") |
|
|||
730 | for f in repo.dirstate.copies: |
|
721 | for f in repo.dirstate.copies: | |
731 | ui.write("%s -> %s\n" % (repo.dirstate.copies[f], f)) |
|
722 | ui.write("copy: %s -> %s\n" % (repo.dirstate.copies[f], f)) | |
732 |
|
723 | |||
733 | def debugdata(ui, file_, rev): |
|
724 | def debugdata(ui, file_, rev): | |
734 | """dump the contents of an data file revision""" |
|
725 | """dump the contents of an data file revision""" | |
@@ -922,7 +913,7 b' def grep(ui, repo, pattern, *pats, **opt' | |||||
922 | cols = [fn, str(rev)] |
|
913 | cols = [fn, str(rev)] | |
923 | if opts['line_number']: cols.append(str(l.linenum)) |
|
914 | if opts['line_number']: cols.append(str(l.linenum)) | |
924 | if opts['every_match']: cols.append(change) |
|
915 | if opts['every_match']: cols.append(change) | |
925 |
if opts['user']: cols.append(trimuser(ui, |
|
916 | if opts['user']: cols.append(trimuser(ui, getchange(rev)[1], rev, | |
926 | ucache)) |
|
917 | ucache)) | |
927 | if opts['files_with_matches']: |
|
918 | if opts['files_with_matches']: | |
928 | c = (fn, rev) |
|
919 | c = (fn, rev) |
@@ -507,14 +507,7 b' class hgweb:' | |||||
507 | name = bcache[r] |
|
507 | name = bcache[r] | |
508 | except KeyError: |
|
508 | except KeyError: | |
509 | cl = self.repo.changelog.read(cnode) |
|
509 | cl = self.repo.changelog.read(cnode) | |
510 | name = cl[1] |
|
510 | bcache[r] = name = self.repo.ui.shortuser(cl[1]) | |
511 | f = name.find('@') |
|
|||
512 | if f >= 0: |
|
|||
513 | name = name[:f] |
|
|||
514 | f = name.find('<') |
|
|||
515 | if f >= 0: |
|
|||
516 | name = name[f+1:] |
|
|||
517 | bcache[r] = name |
|
|||
518 |
|
511 | |||
519 | if last != cnode: |
|
512 | if last != cnode: | |
520 | parity = 1 - parity |
|
513 | parity = 1 - parity | |
@@ -929,8 +922,16 b' def server(path, name, templates, addres' | |||||
929 | # This is a stopgap |
|
922 | # This is a stopgap | |
930 | class hgwebdir: |
|
923 | class hgwebdir: | |
931 | def __init__(self, config): |
|
924 | def __init__(self, config): | |
932 | self.cp = ConfigParser.SafeConfigParser() |
|
925 | if type(config) == type([]): | |
933 |
self. |
|
926 | self.repos = config | |
|
927 | elif type(config) == type({}): | |||
|
928 | self.repos = config.items() | |||
|
929 | self.repos.sort() | |||
|
930 | else: | |||
|
931 | cp = ConfigParser.SafeConfigParser() | |||
|
932 | cp.read(config) | |||
|
933 | self.repos = cp.items("paths") | |||
|
934 | self.repos.sort() | |||
934 |
|
935 | |||
935 | def run(self): |
|
936 | def run(self): | |
936 | def header(**map): |
|
937 | def header(**map): | |
@@ -939,53 +940,37 b' class hgwebdir:' | |||||
939 | def footer(**map): |
|
940 | def footer(**map): | |
940 | yield tmpl("footer", **map) |
|
941 | yield tmpl("footer", **map) | |
941 |
|
942 | |||
942 |
|
|
943 | m = os.path.join(templatepath(), "map") | |
943 | m = os.path.join(templates, "map") |
|
|||
944 | tmpl = templater(m, common_filters, |
|
944 | tmpl = templater(m, common_filters, | |
945 | {"header": header, "footer": footer}) |
|
945 | {"header": header, "footer": footer}) | |
946 |
|
946 | |||
947 | def entries(**map): |
|
947 | def entries(**map): | |
948 | parity = 0 |
|
948 | parity = 0 | |
949 | l = self.cp.items("paths") |
|
949 | for name, path in self.repos: | |
950 |
|
|
950 | u = ui() | |
951 | for v,r in l: |
|
951 | u.readconfig(file(os.path.join(path, '.hg', 'hgrc'))) | |
952 | cp2 = ConfigParser.SafeConfigParser() |
|
952 | get = u.config | |
953 | cp2.read(os.path.join(r, ".hg", "hgrc")) |
|
|||
954 |
|
953 | |||
955 | def get(sec, val, default): |
|
954 | url = ('/'.join([os.environ["REQUEST_URI"], name]) | |
956 |
|
|
955 | .replace("//", "/")) | |
957 | return cp2.get(sec, val) |
|
|||
958 | except: |
|
|||
959 | return default |
|
|||
960 |
|
956 | |||
961 | url = os.environ["REQUEST_URI"] + "/" + v |
|
957 | yield dict(contact=get("web", "contact") or | |
962 | url = url.replace("//", "/") |
|
958 | get("web", "author", "unknown"), | |
963 |
|
959 | name=get("web", "name", name), | ||
964 | yield dict(author=get("web", "author", "unknown"), |
|
|||
965 | name=get("web", "name", v), |
|
|||
966 | url=url, |
|
960 | url=url, | |
967 | parity=parity, |
|
961 | parity=parity, | |
968 | shortdesc=get("web", "description", "unknown"), |
|
962 | shortdesc=get("web", "description", "unknown"), | |
969 |
lastupdate=os.stat(os.path.join( |
|
963 | lastupdate=os.stat(os.path.join(path, ".hg", | |
970 |
|
|
964 | "00changelog.d")).st_mtime) | |
971 |
|
965 | |||
972 | parity = 1 - parity |
|
966 | parity = 1 - parity | |
973 |
|
967 | |||
974 | try: |
|
968 | virtual = os.environ.get("PATH_INFO", "").strip('/') | |
975 | virtual = os.environ["PATH_INFO"] |
|
969 | if virtual: | |
976 | except: |
|
970 | real = dict(self.repos).get(virtual) | |
977 |
|
|
971 | if real: | |
978 |
|
972 | hgweb(real).run() | ||
979 | virtual = virtual.strip('/') |
|
|||
980 |
|
||||
981 | if len(virtual): |
|
|||
982 | if self.cp.has_option("paths", virtual): |
|
|||
983 | real = self.cp.get("paths", virtual) |
|
|||
984 | h = hgweb(real) |
|
|||
985 | h.run() |
|
|||
986 | return |
|
|||
987 | else: |
|
973 | else: | |
988 |
write(tmpl("notfound", repo |
|
974 | write(tmpl("notfound", repo=virtual)) | |
989 | return |
|
975 | else: | |
990 |
|
976 | write(tmpl("index", entries=entries)) | ||
991 | write(tmpl("index", entries=entries)) |
|
@@ -27,11 +27,6 b' class localrepository:' | |||||
27 |
|
27 | |||
28 | self.root = os.path.abspath(path) |
|
28 | self.root = os.path.abspath(path) | |
29 | self.ui = ui |
|
29 | self.ui = ui | |
30 |
|
||||
31 | if create: |
|
|||
32 | os.mkdir(self.path) |
|
|||
33 | os.mkdir(self.join("data")) |
|
|||
34 |
|
||||
35 | self.opener = util.opener(self.path) |
|
30 | self.opener = util.opener(self.path) | |
36 | self.wopener = util.opener(self.root) |
|
31 | self.wopener = util.opener(self.root) | |
37 | self.manifest = manifest.manifest(self.opener) |
|
32 | self.manifest = manifest.manifest(self.opener) | |
@@ -39,6 +34,13 b' class localrepository:' | |||||
39 | self.tagscache = None |
|
34 | self.tagscache = None | |
40 | self.nodetagscache = None |
|
35 | self.nodetagscache = None | |
41 |
|
36 | |||
|
37 | if create: | |||
|
38 | os.mkdir(self.path) | |||
|
39 | os.mkdir(self.join("data")) | |||
|
40 | f = self.opener("hgrc", "w") | |||
|
41 | f.write("[web]\n") | |||
|
42 | f.write("contact = %s\n" % ui.shortuser(ui.username())) | |||
|
43 | ||||
42 | self.dirstate = dirstate.dirstate(self.opener, ui, self.root) |
|
44 | self.dirstate = dirstate.dirstate(self.opener, ui, self.root) | |
43 | try: |
|
45 | try: | |
44 | self.ui.readconfig(self.opener("hgrc")) |
|
46 | self.ui.readconfig(self.opener("hgrc")) |
@@ -78,6 +78,17 b' class ui:' | |||||
78 | os.environ.get("USERNAME", "unknown")) |
|
78 | os.environ.get("USERNAME", "unknown")) | |
79 | + '@' + socket.getfqdn())) |
|
79 | + '@' + socket.getfqdn())) | |
80 |
|
80 | |||
|
81 | def shortuser(self, user): | |||
|
82 | """Return a short representation of a user name or email address.""" | |||
|
83 | if not self.verbose: | |||
|
84 | f = user.find('@') | |||
|
85 | if f >= 0: | |||
|
86 | user = user[:f] | |||
|
87 | f = user.find('<') | |||
|
88 | if f >= 0: | |||
|
89 | user = user[f+1:] | |||
|
90 | return user | |||
|
91 | ||||
81 | def expandpath(self, loc): |
|
92 | def expandpath(self, loc): | |
82 | paths = {} |
|
93 | paths = {} | |
83 | for name, path in self.configitems("paths"): |
|
94 | for name, path in self.configitems("paths"): |
@@ -35,7 +35,7 b' changelogtag = "<tr><th class="tag">tag:' | |||||
35 | changesettag = "<tr><th class="tag">tag:</th><td class="tag">#tag#</td></tr>" |
|
35 | changesettag = "<tr><th class="tag">tag:</th><td class="tag">#tag#</td></tr>" | |
36 | filediffparent = "<tr><th class="parent">parent #rev#:</th><td class="parent"><a href="?cmd=changeset;node=#node#">#node|short#</a></td></tr>" |
|
36 | filediffparent = "<tr><th class="parent">parent #rev#:</th><td class="parent"><a href="?cmd=changeset;node=#node#">#node|short#</a></td></tr>" | |
37 | filelogparent = "<tr><td align="right">parent #rev#: </td><td><a href="?cmd=file;file=#file#;filenode=#node#">#node|short#</a></td></tr>" |
|
37 | filelogparent = "<tr><td align="right">parent #rev#: </td><td><a href="?cmd=file;file=#file#;filenode=#node#">#node|short#</a></td></tr>" | |
38 |
indexentry = "<tr class="parity#parity#"><td><a href="#url#">#name#</a></td><td>#shortdesc#</td><td># |
|
38 | indexentry = "<tr class="parity#parity#"><td><a href="#url#">#name#</a></td><td>#shortdesc#</td><td>#contact|obfuscate#</td><td>#lastupdate|age# ago</td><td><a href="#url#?cmd=changelog;style=rss">RSS</a></td></tr>" | |
39 | index = index.tmpl |
|
39 | index = index.tmpl | |
40 | archiveentry = "<a href="?cmd=archive;node=#node#;type=#type#">#type#</a> " |
|
40 | archiveentry = "<a href="?cmd=archive;node=#node#;type=#type#">#type#</a> " | |
41 | notfound = notfound.tmpl |
|
41 | notfound = notfound.tmpl |
@@ -7,6 +7,6 b'' | |||||
7 |
|
7 | |||
8 | The specified repository "#repo#" is unknown, sorry. |
|
8 | The specified repository "#repo#" is unknown, sorry. | |
9 |
|
9 | |||
10 | Go back to main page, please click <a href="/hg">here</a> |
|
10 | Please go back to the main repository list page. | |
11 |
|
11 | |||
12 | #footer# |
|
12 | #footer# |
@@ -8,11 +8,11 b' hg commit -m1 -d"0 0"' | |||||
8 | echo "# should show copy" |
|
8 | echo "# should show copy" | |
9 | cp foo bar |
|
9 | cp foo bar | |
10 | hg copy foo bar |
|
10 | hg copy foo bar | |
11 | hg debugstate |
|
11 | hg debugstate|grep ^copy | |
12 |
|
12 | |||
13 | echo "# shouldn't show copy" |
|
13 | echo "# shouldn't show copy" | |
14 | hg commit -m2 -d"0 0" |
|
14 | hg commit -m2 -d"0 0" | |
15 | hg debugstate |
|
15 | hg debugstate|grep ^copy | |
16 |
|
16 | |||
17 | echo "# should match" |
|
17 | echo "# should match" | |
18 | hg debugindex .hg/data/foo.i |
|
18 | hg debugindex .hg/data/foo.i | |
@@ -28,7 +28,7 b' hg debugrename bar' | |||||
28 | cp foo bar |
|
28 | cp foo bar | |
29 | hg copy foo bar |
|
29 | hg copy foo bar | |
30 | echo "# should show copy" |
|
30 | echo "# should show copy" | |
31 | hg debugstate |
|
31 | hg debugstate|grep ^copy | |
32 | hg commit -m3 -d"0 0" |
|
32 | hg commit -m3 -d"0 0" | |
33 |
|
33 | |||
34 | echo "# should show no parents for tip" |
|
34 | echo "# should show no parents for tip" | |
@@ -38,4 +38,6 b' hg debugindex .hg/data/foo.i' | |||||
38 | hg debugrename bar |
|
38 | hg debugrename bar | |
39 |
|
39 | |||
40 | echo "# should show no copies" |
|
40 | echo "# should show no copies" | |
41 | hg debugstate No newline at end of file |
|
41 | hg debugstate|grep ^copy | |
|
42 | ||||
|
43 | exit 0 |
@@ -1,12 +1,6 b'' | |||||
1 | # should show copy |
|
1 | # should show copy | |
2 | a 644 4 08/28/05 05:00:19 bar |
|
2 | copy: foo -> bar | |
3 | n 644 4 08/28/05 05:00:19 foo |
|
|||
4 |
|
||||
5 | foo -> bar |
|
|||
6 | # shouldn't show copy |
|
3 | # shouldn't show copy | |
7 | n 644 4 08/28/05 05:00:19 bar |
|
|||
8 | n 644 4 08/28/05 05:00:19 foo |
|
|||
9 |
|
||||
10 | # should match |
|
4 | # should match | |
11 | rev offset length base linkrev nodeid p1 p2 |
|
5 | rev offset length base linkrev nodeid p1 p2 | |
12 | 0 0 5 0 0 2ed2a3912a0b 000000000000 000000000000 |
|
6 | 0 0 5 0 0 2ed2a3912a0b 000000000000 000000000000 | |
@@ -14,10 +8,7 b' renamed from foo:2ed2a3912a0b24502043eae' | |||||
14 | # should not be renamed |
|
8 | # should not be renamed | |
15 | not renamed |
|
9 | not renamed | |
16 | # should show copy |
|
10 | # should show copy | |
17 | n 644 5 08/28/05 05:00:19 bar |
|
11 | copy: foo -> bar | |
18 | n 644 6 08/28/05 05:00:19 foo |
|
|||
19 |
|
||||
20 | foo -> bar |
|
|||
21 | # should show no parents for tip |
|
12 | # should show no parents for tip | |
22 | rev offset length base linkrev nodeid p1 p2 |
|
13 | rev offset length base linkrev nodeid p1 p2 | |
23 | 0 0 69 0 1 6ca237634e1f 000000000000 000000000000 |
|
14 | 0 0 69 0 1 6ca237634e1f 000000000000 000000000000 | |
@@ -29,6 +20,3 b' foo -> bar' | |||||
29 | 1 5 7 1 2 dd12c926cf16 2ed2a3912a0b 000000000000 |
|
20 | 1 5 7 1 2 dd12c926cf16 2ed2a3912a0b 000000000000 | |
30 | renamed from foo:dd12c926cf165e3eb4cf87b084955cb617221c17 |
|
21 | renamed from foo:dd12c926cf165e3eb4cf87b084955cb617221c17 | |
31 | # should show no copies |
|
22 | # should show no copies | |
32 | n 644 6 08/28/05 05:00:19 bar |
|
|||
33 | n 644 6 08/28/05 05:00:19 foo |
|
|||
34 |
|
General Comments 0
You need to be logged in to leave comments.
Login now