Sun, 19 Apr 2015 20:04:05 +0300
- added hex support to the calculator
124
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
1 | ''' |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
2 | Copyright 2014-2015 Teemu Piippo |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
3 | All rights reserved. |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
4 | |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
5 | Redistribution and use in source and binary forms, with or without |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
6 | modification, are permitted provided that the following conditions |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
7 | are met: |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
8 | |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
9 | 1. Redistributions of source code must retain the above copyright |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
10 | notice, this list of conditions and the following disclaimer. |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
11 | 2. Redistributions in binary form must reproduce the above copyright |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
12 | notice, this list of conditions and the following disclaimer in the |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
13 | documentation and/or other materials provided with the distribution. |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
14 | 3. The name of the author may not be used to endorse or promote products |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
15 | derived from this software without specific prior written permission. |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
16 | |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
17 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
18 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
19 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
20 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
21 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
22 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
23 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
24 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
25 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
26 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
27 | ''' |
7b2cd8b1ba86
- now with extra license headers
Teemu Piippo <crimsondusk64@gmail.com>
parents:
123
diff
changeset
|
28 | |
73
d67cc4fbc3f1
- modularization complete!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
29 | import hgapi |
d67cc4fbc3f1
- modularization complete!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
30 | import time |
d67cc4fbc3f1
- modularization complete!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
31 | import re |
d67cc4fbc3f1
- modularization complete!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
32 | import bt as Bt |
d67cc4fbc3f1
- modularization complete!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
33 | import irc as Irc |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
34 | import os, sqlite3, subprocess |
73
d67cc4fbc3f1
- modularization complete!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
35 | from datetime import datetime |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
36 | from configfile import Config |
120
9880bb697149
- added doomseeker support, fixed up mod_bridge, now shortens new commit links with bit.ly
Teemu Piippo <crimsondusk64@gmail.com>
parents:
115
diff
changeset
|
37 | import utility |
123
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
38 | g_CommitsDb = None |
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
39 | |
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
40 | def all_repo_names(): |
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
41 | return Config.get_node ('hg').get_value ('repos', {}).keys() |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
42 | |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
43 | class CommitsDb (object): |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
44 | def __init__(self): |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
45 | needNew = not os.path.isfile ('commits.db') |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
46 | self.db = sqlite3.connect ('commits.db') |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
47 | |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
48 | if needNew: |
122
f899af683bbe
- fixed a derp in commitsdb
Teemu Piippo <crimsondusk64@gmail.com>
parents:
121
diff
changeset
|
49 | self.create_new() |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
50 | |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
51 | def create_new (self): |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
52 | self.db.executescript (''' |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
53 | DROP TABLE IF EXISTS COMMITS; |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
54 | DROP TABLE IF EXISTS REPOS; |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
55 | DROP TABLE IF EXISTS REPOCOMMITS; |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
56 | CREATE TABLE IF NOT EXISTS COMMITS |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
57 | ( |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
58 | Node text NOT NULL, |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
59 | Dateversion text NOT NULL, |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
60 | PRIMARY KEY (Node) |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
61 | ); |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
62 | CREATE TABLE IF NOT EXISTS REPOS |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
63 | ( |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
64 | Name text NOT NULL, |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
65 | PRIMARY KEY (Name) |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
66 | ); |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
67 | CREATE TABLE IF NOT EXISTS REPOCOMMITS |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
68 | ( |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
69 | Reponame text, |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
70 | Node text, |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
71 | FOREIGN KEY (Reponame) REFERENCES REPOS(Name), |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
72 | FOREIGN KEY (Node) REFERENCES COMMITS(Node) |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
73 | ); |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
74 | ''') |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
75 | |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
76 | print 'Building commits.db...' |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
77 | for repo in all_repo_names(): |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
78 | print 'Adding commits from %s...' % repo |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
79 | |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
80 | data = subprocess.check_output (['hg', '--cwd', repo, 'log', '--template', |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
81 | '{node} {date|hgdate}\n']).splitlines() |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
82 | |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
83 | for line in data: |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
84 | changeset, timestamp, tz = line.split(' ') |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
85 | self.add_commit (repo, changeset, int (timestamp)) |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
86 | |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
87 | self.commit() |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
88 | |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
89 | def add_commit (self, repo, changeset, timestamp): |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
90 | dateversion = datetime.utcfromtimestamp (timestamp).strftime ('%y%m%d-%H%M') |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
91 | self.db.execute (''' |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
92 | INSERT OR IGNORE INTO REPOS |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
93 | VALUES (?) |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
94 | ''', (repo,)) |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
95 | |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
96 | self.db.execute (''' |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
97 | INSERT OR IGNORE INTO COMMITS |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
98 | VALUES (?, ?) |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
99 | ''', (changeset, dateversion)) |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
100 | |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
101 | self.db.execute (''' |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
102 | INSERT INTO REPOCOMMITS |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
103 | VALUES (?, ?) |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
104 | ''', (repo, changeset)) |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
105 | |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
106 | def get_commit_repos (self, node): |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
107 | cursor = self.db.execute (''' |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
108 | SELECT Reponame |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
109 | FROM REPOCOMMITS |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
110 | WHERE Node LIKE ? |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
111 | ''', (node + '%',)) |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
112 | |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
113 | results = cursor.fetchall() |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
114 | return list (set (zip (*results)[0])) if results else [] |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
115 | |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
116 | def find_commit_by_dateversion (self, dateversion): |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
117 | cursor = self.db.execute (''' |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
118 | SELECT Node |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
119 | FROM COMMITS |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
120 | WHERE Dateversion = ? |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
121 | ''', (dateversion,)) |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
122 | result = cursor.fetchone() |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
123 | return result[0] if result else None |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
124 | |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
125 | def commit(self): |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
126 | self.db.commit() |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
127 | |
110 | 128 | def color_for_repo (repo_name): |
120
9880bb697149
- added doomseeker support, fixed up mod_bridge, now shortens new commit links with bit.ly
Teemu Piippo <crimsondusk64@gmail.com>
parents:
115
diff
changeset
|
129 | repo_name = repo_name.lower() |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
130 | repoconfig = Config.get_node ('hg').get_node ('repos') |
120
9880bb697149
- added doomseeker support, fixed up mod_bridge, now shortens new commit links with bit.ly
Teemu Piippo <crimsondusk64@gmail.com>
parents:
115
diff
changeset
|
131 | |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
132 | if repoconfig.has_node (repo_name): |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
133 | return repoconfig.get_node(repo_name).get_value ('colorcode', 0) |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
134 | |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
135 | return 0 |
110 | 136 | |
111 | 137 | def prettify_bookmarks (bookmarks): |
123
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
138 | if bookmarks: |
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
139 | return "\0036 [\002%s\002]" % bookmarks |
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
140 | else: |
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
141 | return '' |
111 | 142 | |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
143 | def get_repo_info (reponame): |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
144 | reponame = reponame.lower() |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
145 | repoconfig = Config.get_node ('hg').get_node ('repos') |
87 | 146 | |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
147 | if repoconfig.has_node (reponame): |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
148 | return repoconfig.get_node (reponame) |
87 | 149 | |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
150 | return None |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
151 | |
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
152 | ' Check if a repository exists ' |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
153 | def check_repo_exists (repo_name): |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
154 | print 'Checking that %s exists...' % repo_name |
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
155 | zanrepo = hgapi.Repo (repo_name) |
87 | 156 | |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
157 | if not os.path.exists (repo_name): |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
158 | os.makedirs (repo_name) |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
159 | |
123
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
160 | if not os.path.isfile (os.path.join (repo_name, '.hg', 'hgrc')): |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
161 | # If the repo does not exist, clone it. |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
162 | repo_url = get_repo_info (repo_name).get_value ('url') |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
163 | try: |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
164 | print ('Cloning %s...' % repo_name) |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
165 | zanrepo.hg_clone (repo_url, repo_name) |
123
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
166 | |
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
167 | # We need to un-alias a few things, they can be aliased on the host machine (e.g. mine) |
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
168 | comms=['log', 'incoming', 'pull', 'commit', 'push', 'outgoing', 'strip', 'transplant'] |
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
169 | try: |
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
170 | with open (os.path.join (repo_name, '.hg', 'hgrc'), 'a') as fp: |
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
171 | fp.write ('\n[alias]\n' + ''.join(['%s=%s\n' % (x, x) for x in comms])) |
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
172 | except Exception as e: |
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
173 | print ('Warning: unable to alter hgrc of %s: %s' % repo_name, e) |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
174 | print ('Cloning done.') |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
175 | except Exception as e: |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
176 | print ('Unable to clone %s from %s: %s' % (repo_name, repo_url, e)) |
73
d67cc4fbc3f1
- modularization complete!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
177 | quit (1) |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
178 | |
88 | 179 | |
180 | class HgProcessError (Exception): | |
181 | def __init__ (self, value): | |
182 | self.message = value | |
183 | def __str__ (self): | |
184 | return self.message | |
185 | ||
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
186 | def announce_ticket_resolved (ticket_id, cset): |
91 | 187 | ticket_id = int (ticket_id) |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
188 | reponames = g_CommitsDb.get_commit_repos (cset) |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
189 | |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
190 | if not reponames: |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
191 | raise HgProcessError ('Changeset %s does not appear to exist!' % cset) |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
192 | |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
193 | for reponame in reponames: |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
194 | repoinfo = get_repo_info (reponame) |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
195 | if not repoinfo: |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
196 | raise HgProcessError ('Unknown repo %s' % reponame) |
91 | 197 | |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
198 | if not repoinfo.get_value ('private', default=False): |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
199 | break |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
200 | else: |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
201 | raise HgProcessError ('Changeset %s is only committed to non-published repositories %s' % |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
202 | (cset, reponames)) |
89 | 203 | |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
204 | repo = hgapi.Repo (reponame) |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
205 | repo_url = repoinfo.get_value ('url', default=None) |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
206 | |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
207 | if not repo_url: |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
208 | raise HgProcessError ('Repo %s has no url!' % reponame) |
87 | 209 | |
210 | # Acquire additional data | |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
211 | moredata = get_commit_data (repo, cset, |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
212 | r"{author|nonempty}\n{date(date, '%A %d %B %Y %H:%M:%S')}").split('\n') |
87 | 213 | |
214 | if len (moredata) != 2: | |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
215 | raise HgProcessError ('malformed hg data while processing %s' % cset) |
87 | 216 | |
217 | commit_author = moredata[0] | |
218 | commit_date = moredata[1] | |
219 | commit_email = "" | |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
220 | commit_message = repo.hg_command ('log', '-r', cset, '--template', '{desc}') |
87 | 221 | |
222 | try: | |
223 | ticket_data = Bt.get_issue (ticket_id) | |
224 | except Exception as e: | |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
225 | raise HgProcessError ("error while processing %s: %s" % (cset, e)) |
87 | 226 | |
227 | # Remove the email address from the author if possible | |
228 | rex = re.compile (r'^(.+) <([^>]+)>$.*') | |
229 | match = rex.match (commit_author) | |
230 | if match: | |
231 | commit_author = match.group (1) | |
232 | commit_email = match.group (2) | |
233 | ||
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
234 | commit_diffstat = repo.hg_command ('diff', '--change', cset, '--stat') |
87 | 235 | |
236 | if len(commit_diffstat) > 0: | |
237 | # commit_diffstat = 'Changes in files:\n[code]\n' + commit_diffstat + '\n[/code]' | |
238 | commit_diffstat = 'Changes in files:\n' + bbcodify(commit_diffstat) | |
239 | else: | |
240 | commit_diffstat = 'No changes in files.' | |
241 | ||
242 | # Compare the email addresses against known developer usernames | |
243 | commit_trackeruser = Config.find_developer_by_email (commit_email) | |
244 | ||
245 | if commit_trackeruser != '': | |
246 | commit_author += ' [%s]' % commit_trackeruser | |
247 | ||
115 | 248 | commit_message = commit_message.replace ("\n", " ") |
249 | ||
87 | 250 | message = 'Issue addressed by commit %s: [b][url=%s/commits/%s]%s[/url][/b]' \ |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
251 | % (cset, repo_url, cset, commit_message) |
87 | 252 | message += "\nCommitted by %s on %s\n\n%s" \ |
253 | % (commit_author, commit_date, commit_diffstat) | |
254 | ||
255 | need_update = False | |
256 | ||
257 | # If not already set, set handler | |
258 | if not 'handler' in ticket_data: | |
259 | ticket_data['handler'] = {'name': commit_trackeruser} | |
260 | need_update = True | |
261 | ||
262 | # Find out the status level of the ticket | |
263 | needs_testing_level = 70 | |
264 | ||
265 | if ticket_data['status']['id'] < needs_testing_level: | |
266 | ticket_data.status['id'] = needs_testing_level | |
267 | need_update = True | |
268 | ||
269 | # Set target version if not set | |
270 | if not 'target_version' in ticket_data: | |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
271 | ticket_data['target_version'] = repoinfo.get_value ('version') |
87 | 272 | need_update = True |
273 | ||
274 | # Announce on IRC | |
275 | for irc_client in Irc.all_clients: | |
276 | for channel in irc_client.channels: | |
277 | if channel.get_value ('btannounce', default=True): | |
278 | irc_client.privmsg (channel.get_value ('name'), | |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
279 | "\003%d%s\003: commit\0035 %s\003 addresses issue\002\0032 %d\002" % (color_for_repo (reponame), reponame, cset, ticket_id)) |
87 | 280 | irc_client.privmsg (channel.get_value ('name'), |
281 | "Read all about it here: " + Bt.get_ticket_url (ticket_id)) | |
282 | ||
283 | if need_update: | |
284 | # We need to remove the note data, otherwise the ticket notes | |
285 | # will get unnecessary updates. WTF, MantisBT? | |
286 | ticket_data.notes = [] | |
287 | Bt.update_issue (ticket_id, ticket_data) | |
288 | ||
289 | Bt.post_note (ticket_id, message) | |
290 | ||
123
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
291 | def init(): |
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
292 | global repocheck_timeout |
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
293 | global g_CommitsDb |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
294 | |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
295 | for repo in all_repo_names(): |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
296 | check_repo_exists (repo) |
123
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
297 | |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
298 | repocheck_timeout = time.time() + 15 |
123
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
299 | g_CommitsDb = CommitsDb() |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
300 | |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
301 | def get_commit_data (repo, rev, template): |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
302 | return repo.hg_command ('log', '-l', '1', '-r', rev, '--template', template) |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
303 | |
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
304 | def decipher_hgapi_error (e): |
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
305 | # Blah, hgapi, why must your error messages be so mangled? |
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
306 | try: |
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
307 | rawmsg = e.message.replace('\n', '').replace('" +','').replace('\t','') |
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
308 | errmsg = re.compile (r'.*: tErr: (.*)Out:.*').match (rawmsg).group (1) |
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
309 | return [True, errmsg] |
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
310 | except: |
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
311 | return [False, ''] |
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
312 | |
73
d67cc4fbc3f1
- modularization complete!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
313 | def bbcodify (commit_diffstat): |
d67cc4fbc3f1
- modularization complete!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
314 | result = '' |
87 | 315 | |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
316 | for line in commit_diffstat.split('\n'): |
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
317 | rex = re.compile (r'^(.*)\|(.*) (\+*)(-*)(.*)$') |
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
318 | match = rex.match (line) |
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
319 | if match: |
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
320 | line = '%s|%s [color=#5F7]%s[/color][color=#F53]%s[/color]%s\n' \ |
111 | 321 | % (match.group (1), match.group (2), match.group (3), |
322 | match.group (4), match.group (5)) | |
87 | 323 | |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
324 | # Tracker doesn't seem to like empty color tags |
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
325 | line = line.replace ('[color=#5F7][/color]', '').replace ('[color=#F53][/color]', '') |
87 | 326 | |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
327 | result += line |
87 | 328 | |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
329 | return result |
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
330 | |
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
331 | def poll(): |
73
d67cc4fbc3f1
- modularization complete!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
332 | global repocheck_timeout |
d67cc4fbc3f1
- modularization complete!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
333 | if time.time() < repocheck_timeout: |
d67cc4fbc3f1
- modularization complete!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
334 | return |
87 | 335 | |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
336 | for reponame in all_repo_names(): |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
337 | poll_one_repo (reponame) |
87 | 338 | |
73
d67cc4fbc3f1
- modularization complete!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
339 | hgns = Config.get_node ('hg') |
d67cc4fbc3f1
- modularization complete!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
340 | repocheck_timeout = time.time() + hgns.get_value ('checkinterval', default=15) * 60 |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
341 | |
73
d67cc4fbc3f1
- modularization complete!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
342 | def poll_one_repo (repo_name): |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
343 | global repocheck_timeout |
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
344 | hgns = Config.get_node ('hg') |
87 | 345 | |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
346 | if not hgns.get_value ('track', default=True): |
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
347 | return |
87 | 348 | |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
349 | repo = hgapi.Repo (repo_name) |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
350 | commit_data = [] |
123
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
351 | delimeter = '^^^^^^^^^^' |
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
352 | delimeter2 = '@@@@@@@@@@' |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
353 | print 'Checking %s for updates' % repo_name |
87 | 354 | |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
355 | try: |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
356 | data = repo.hg_command ('incoming', '--quiet', '--template', |
123
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
357 | delimeter.join (['{node|short}', '{desc}']) + delimeter2).split (delimeter2) |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
358 | except hgapi.hgapi.HgException as e: |
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
359 | deciphered = decipher_hgapi_error (e) |
87 | 360 | |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
361 | if deciphered[0] and len(deciphered[1]) > 0: |
123
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
362 | Irc.broadcast ("error while using hg incoming on %s: %s" % (repo_name, deciphered[1])) |
87 | 363 | |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
364 | return |
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
365 | except Exception as e: |
73
d67cc4fbc3f1
- modularization complete!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
366 | Irc.broadcast ("%s" % `e`) |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
367 | return |
87 | 368 | |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
369 | if not data: |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
370 | print ('No updates to %s' % repo_name) |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
371 | |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
372 | for line in data: |
123
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
373 | if line: |
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
374 | commit_data.append (line.split (delimeter)) |
87 | 375 | |
97 | 376 | process_new_commits (repo_name, commit_data) |
377 | ||
378 | def process_new_commits (repo_name, commit_data): | |
108
8cf31b4d5fcb
- we now need an explicit check against double-processing commits
Teemu Piippo <crimsondusk64@gmail.com>
parents:
101
diff
changeset
|
379 | if len (commit_data) == 0: |
8cf31b4d5fcb
- we now need an explicit check against double-processing commits
Teemu Piippo <crimsondusk64@gmail.com>
parents:
101
diff
changeset
|
380 | return |
8cf31b4d5fcb
- we now need an explicit check against double-processing commits
Teemu Piippo <crimsondusk64@gmail.com>
parents:
101
diff
changeset
|
381 | |
120
9880bb697149
- added doomseeker support, fixed up mod_bridge, now shortens new commit links with bit.ly
Teemu Piippo <crimsondusk64@gmail.com>
parents:
115
diff
changeset
|
382 | repo_name = repo_name.lower() |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
383 | repo_url = get_repo_info (repo_name).get_value ('url') |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
384 | ispublishing = not get_repo_info (repo_name).get_value ('private', False) |
98
4edbdf390bd1
- fix previous commit
Teemu Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
385 | num_commits = 0 |
4edbdf390bd1
- fix previous commit
Teemu Piippo <crimsondusk64@gmail.com>
parents:
97
diff
changeset
|
386 | zanrepo = hgapi.Repo (repo_name) |
110 | 387 | print '%d new commits on %s' % (len (commit_data), repo_name) |
123
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
388 | pull_args = [] |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
389 | |
108
8cf31b4d5fcb
- we now need an explicit check against double-processing commits
Teemu Piippo <crimsondusk64@gmail.com>
parents:
101
diff
changeset
|
390 | for commit in commit_data: |
8cf31b4d5fcb
- we now need an explicit check against double-processing commits
Teemu Piippo <crimsondusk64@gmail.com>
parents:
101
diff
changeset
|
391 | pull_args.append ('-r'); |
8cf31b4d5fcb
- we now need an explicit check against double-processing commits
Teemu Piippo <crimsondusk64@gmail.com>
parents:
101
diff
changeset
|
392 | pull_args.append (commit[0]); |
8cf31b4d5fcb
- we now need an explicit check against double-processing commits
Teemu Piippo <crimsondusk64@gmail.com>
parents:
101
diff
changeset
|
393 | |
8cf31b4d5fcb
- we now need an explicit check against double-processing commits
Teemu Piippo <crimsondusk64@gmail.com>
parents:
101
diff
changeset
|
394 | print 'Pulling new commits...' |
8cf31b4d5fcb
- we now need an explicit check against double-processing commits
Teemu Piippo <crimsondusk64@gmail.com>
parents:
101
diff
changeset
|
395 | try: |
8cf31b4d5fcb
- we now need an explicit check against double-processing commits
Teemu Piippo <crimsondusk64@gmail.com>
parents:
101
diff
changeset
|
396 | zanrepo.hg_command ('pull', *pull_args) |
8cf31b4d5fcb
- we now need an explicit check against double-processing commits
Teemu Piippo <crimsondusk64@gmail.com>
parents:
101
diff
changeset
|
397 | except Exception as e: |
8cf31b4d5fcb
- we now need an explicit check against double-processing commits
Teemu Piippo <crimsondusk64@gmail.com>
parents:
101
diff
changeset
|
398 | Irc.broadcast ('Warning: unable to pull: %s' % `e`) |
8cf31b4d5fcb
- we now need an explicit check against double-processing commits
Teemu Piippo <crimsondusk64@gmail.com>
parents:
101
diff
changeset
|
399 | return |
87 | 400 | |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
401 | for commit in commit_data: |
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
402 | commit_node = commit[0] |
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
403 | commit_message = commit[1] |
73
d67cc4fbc3f1
- modularization complete!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
404 | print 'Processing new commit %s...' % commit_node |
87 | 405 | |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
406 | try: |
123
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
407 | existingrepos = g_CommitsDb.get_commit_repos (commit_node) |
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
408 | alreadyAdded = len (existingrepos) > 0 |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
409 | |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
410 | delim = '@@@@@@@@@@' |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
411 | data = get_commit_data (zanrepo, commit_node, delim.join (['{author}', '{bookmarks}', \ |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
412 | '{date|hgdate}'])).split (delim) |
111 | 413 | commit_author = data[0] |
414 | commit_bookmarks = prettify_bookmarks (data[1]) | |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
415 | commit_time = int (data[2].split (' ')[0]) |
100
2a56ccf67782
- be more liberal on posting commit messages to IRC
Teemu Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
416 | commit_url = '%s/commits/%s' % (repo_url, commit_node) |
2a56ccf67782
- be more liberal on posting commit messages to IRC
Teemu Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
417 | commit_email = '' |
87 | 418 | |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
419 | # If the commit was already in the commits database, it is not a new one and we should |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
420 | # not react to it. Still add it to the db though so that the new repo name is added. |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
421 | g_CommitsDb.add_commit (repo=repo_name, changeset=commit_node, timestamp=commit_time) |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
422 | if alreadyAdded: |
123
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
423 | print ('''I already know of %s - they're in %s - not announcing.''' % |
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
424 | (commit_node, existingrepos)) |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
425 | continue |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
426 | |
100
2a56ccf67782
- be more liberal on posting commit messages to IRC
Teemu Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
427 | # Remove the email address from the author if possible |
2a56ccf67782
- be more liberal on posting commit messages to IRC
Teemu Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
428 | rex = re.compile (r'^(.+) <([^>]+)>$.*') |
2a56ccf67782
- be more liberal on posting commit messages to IRC
Teemu Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
429 | match = rex.match (commit_author) |
2a56ccf67782
- be more liberal on posting commit messages to IRC
Teemu Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
430 | if match: |
2a56ccf67782
- be more liberal on posting commit messages to IRC
Teemu Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
431 | commit_author = match.group (1) |
2a56ccf67782
- be more liberal on posting commit messages to IRC
Teemu Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
432 | commit_email = match.group (2) |
87 | 433 | |
100
2a56ccf67782
- be more liberal on posting commit messages to IRC
Teemu Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
434 | commit_trackeruser = Config.find_developer_by_email (commit_email) |
2a56ccf67782
- be more liberal on posting commit messages to IRC
Teemu Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
435 | committer = commit_trackeruser if commit_trackeruser != '' else commit_author |
87 | 436 | |
100
2a56ccf67782
- be more liberal on posting commit messages to IRC
Teemu Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
437 | for irc_client in Irc.all_clients: |
2a56ccf67782
- be more liberal on posting commit messages to IRC
Teemu Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
438 | for channel in irc_client.channels: |
112 | 439 | if not channel.get_value ('btannounce', False): |
440 | continue | |
441 | ||
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
442 | if ispublishing or channel.get_value ('btprivate', False): |
100
2a56ccf67782
- be more liberal on posting commit messages to IRC
Teemu Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
443 | irc_client.privmsg (channel.get_value ('name'), |
111 | 444 | "\003%d%s\003: new commit\0035 %s%s\003 by\0032 %s\003: %s" |
445 | % (color_for_repo (repo_name), repo_name, commit_node, commit_bookmarks, | |
120
9880bb697149
- added doomseeker support, fixed up mod_bridge, now shortens new commit links with bit.ly
Teemu Piippo <crimsondusk64@gmail.com>
parents:
115
diff
changeset
|
446 | committer, utility.shorten_link (commit_url))) |
87 | 447 | |
123
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
448 | for line in commit_message.splitlines(): |
aeb0d0788869
- added commits.db and mercurial support restructure
Teemu Piippo <crimsondusk64@gmail.com>
parents:
122
diff
changeset
|
449 | irc_client.privmsg (channel.get_value ('name'), ' ' + line) |
87 | 450 | |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
451 | if ispublishing: |
100
2a56ccf67782
- be more liberal on posting commit messages to IRC
Teemu Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
452 | rex = re.compile (r'^.*(fixes|resolves|addresses|should fix) ([0-9]+).*$') |
2a56ccf67782
- be more liberal on posting commit messages to IRC
Teemu Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
453 | match = rex.match (commit_message) |
87 | 454 | |
100
2a56ccf67782
- be more liberal on posting commit messages to IRC
Teemu Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
455 | if match: |
2a56ccf67782
- be more liberal on posting commit messages to IRC
Teemu Piippo <crimsondusk64@gmail.com>
parents:
98
diff
changeset
|
456 | announce_ticket_resolved (match.group (2), commit_node) |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
457 | |
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
458 | num_commits += 1 |
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
459 | except Exception as e: |
73
d67cc4fbc3f1
- modularization complete!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
460 | Irc.broadcast ('Error while processing %s: %s' % (commit_node, e)) |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
461 | continue |
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
462 | |
121
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
463 | g_CommitsDb.commit() |
ac07779f788d
- reworked mercurial repository handling, removed hardcoded values
Teemu Piippo <crimsondusk64@gmail.com>
parents:
120
diff
changeset
|
464 | |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
465 | def force_poll(): |
73
d67cc4fbc3f1
- modularization complete!!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
72
diff
changeset
|
466 | global repocheck_timeout |
72
2266d6d73de3
- commit work done on splitting bt/hg
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
467 | repocheck_timeout = 0 |
85
302e2bec51d8
- fixed bad find_developer_by_email call
Teemu Piippo <crimsondusk64@gmail.com>
parents:
76
diff
changeset
|
468 | poll() |