Skip to content

Commit cbf553f

Browse files
committed
make compile with latest V
1 parent 53179f2 commit cbf553f

14 files changed

+32
-32
lines changed

src/branch.v

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ fn (mut app App) fetch_branch(repo Repo, branch_name string) ! {
4343
}
4444

4545
app.create_branch_or_update(repo.id, branch_name, user.username, last_commit_hash,
46-
int(committed_at.unix))!
46+
int(committed_at.unix()))!
4747
}
4848

4949
fn (mut app App) create_branch_or_update(repository_id int, branch_name string, author string, hash string, date int) ! {

src/comment.v

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fn (mut app App) add_issue_comment(author_id int, issue_id int, text string) ! {
3939
comment := Comment{
4040
author_id: author_id
4141
issue_id: issue_id
42-
created_at: int(time.now().unix)
42+
created_at: int(time.now().unix())
4343
text: text
4444
}
4545

src/feed.v

+1-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ struct FeedItem {
1313
message string
1414
}
1515

16-
const (
17-
feed_items_per_page = 30
18-
)
16+
const feed_items_per_page = 30
1917

2018
fn (mut app App) build_user_feed_as_page(user_id int, offset int) []FeedItem {
2119
mut feed := []FeedItem{}

src/github.v

+2-7
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,7 @@ import vweb
66
import json
77
import net.http
88

9-
struct OAuthRequest {
10-
client_id string
11-
client_secret string
12-
code string
13-
state string
14-
}
9+
import veb.oauth
1510

1611
struct GitHubUser {
1712
username string @[json: 'login']
@@ -46,7 +41,7 @@ pub fn (mut app App) handle_oauth() vweb.Result {
4641
return app.redirect_to_index()
4742
}
4843

49-
oauth_request := OAuthRequest{
44+
oauth_request := oauth.Request{
5045
client_id: app.settings.oauth_client_id
5146
client_secret: app.settings.oauth_client_secret
5247
code: code

src/gitly.v

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ fn new_app() !&App {
4848

4949
mut app := &App{
5050
db: sqlite.connect('gitly.sqlite') or { panic(err) }
51-
started_at: time.now().unix
51+
started_at: time.now().unix()
5252
}
5353

5454
set_rand_crypto_safe_seed()

src/issue.v

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ fn (mut app App) add_issue(repo_id int, author_id int, title string, text string
3939
text: text
4040
repo_id: repo_id
4141
author_id: author_id
42-
created_at: int(time.now().unix)
42+
created_at: int(time.now().unix())
4343
}
4444

4545
sql app.db {

src/release_routes.v

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ module main
33
import vweb
44
import time
55

6-
const (
7-
releases_per_page = 20
8-
)
6+
const releases_per_page = 20
97

108
@['/:username/:repo_name/releases']
119
pub fn (mut app App) releases_default(username string, repo_name string) vweb.Result {

src/repo.v

+10-7
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,9 @@ mut:
4343
}
4444

4545
// log_field_separator is declared as constant in case we need to change it later
46-
const (
47-
max_git_res_size = 1000
48-
log_field_separator = '\x7F'
49-
ignored_folder = ['thirdparty']
50-
)
46+
const max_git_res_size = 1000
47+
const log_field_separator = '\x7F'
48+
const ignored_folder = ['thirdparty']
5149

5250
enum RepoStatus {
5351
done
@@ -256,6 +254,7 @@ fn (mut app App) user_has_repo(user_id int, repo_name string) bool {
256254
}
257255

258256
fn (mut app App) update_repo_from_fs(mut repo Repo) ! {
257+
println('UPDATE REPO FROM FS')
259258
repo_id := repo.id
260259

261260
app.db.exec('BEGIN TRANSACTION')!
@@ -266,6 +265,7 @@ fn (mut app App) update_repo_from_fs(mut repo Repo) ! {
266265
app.fetch_branches(repo)!
267266

268267
branches_output := repo.git('branch -a')
268+
println('b output=${branches_output}')
269269

270270
for branch_output in branches_output.split_into_lines() {
271271
branch_name := git.parse_git_branch_output(branch_output)
@@ -297,6 +297,8 @@ fn (mut app App) update_repo_branch_from_fs(mut repo Repo, branch_name string) !
297297
}
298298

299299
data := repo.git('--no-pager log ${branch_name} --abbrev-commit --abbrev=7 --pretty="%h${log_field_separator}%aE${log_field_separator}%cD${log_field_separator}%s${log_field_separator}%aN"')
300+
println('DATA=')
301+
println(data)
300302

301303
for line in data.split_into_lines() {
302304
args := line.split(log_field_separator)
@@ -322,7 +324,7 @@ fn (mut app App) update_repo_branch_from_fs(mut repo Repo, branch_name string) !
322324
}
323325

324326
app.add_commit_if_not_exist(repo_id, branch.id, commit_hash, commit_author,
325-
commit_author_id, commit_message, int(commit_date.unix))!
327+
commit_author_id, commit_message, int(commit_date.unix()))!
326328
}
327329
}
328330
}
@@ -396,7 +398,7 @@ fn (mut app App) update_repo_branch_data(mut repo Repo, branch_name string) ! {
396398
}
397399

398400
app.add_commit_if_not_exist(repo_id, branch.id, commit_hash, commit_author,
399-
commit_author_id, commit_message, int(commit_date.unix))!
401+
commit_author_id, commit_message, int(commit_date.unix()))!
400402
}
401403
}
402404
}
@@ -765,6 +767,7 @@ fn (mut app App) update_repo_primary_branch(repo_id int, branch string) ! {
765767
}
766768

767769
fn (mut r Repo) clone() {
770+
println('R CLONE')
768771
if r.git_repo != unsafe { nil } {
769772
r.git_repo.clone(r.clone_url, r.git_dir)
770773
} else {

src/repo_routes.v

+6-1
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ pub fn (mut app App) handle_repo_move(username string, repo_name string, dest st
136136

137137
@['/:username/:repo_name']
138138
pub fn (mut app App) handle_tree(username string, repo_name string) vweb.Result {
139+
println('handle tree()')
139140
match repo_name {
140141
'repos' {
141142
return app.user_repos(username)
@@ -287,7 +288,7 @@ pub fn (mut app App) foo(mut new_repo Repo) {
287288
// git.clone(valid_clone_url, repo_path)
288289
}
289290

290-
@['/:user/:repository/tree/:branch_name/:path...']
291+
@['/:username/:repo_name/tree/:branch_name/:path...']
291292
pub fn (mut app App) tree(username string, repo_name string, branch_name string, path string) vweb.Result {
292293
mut repo := app.find_repo_by_name_and_username(repo_name, username) or {
293294
return app.not_found()
@@ -338,6 +339,7 @@ pub fn (mut app App) tree(username string, repo_name string, branch_name string,
338339
branch := app.find_repo_branch_by_name(repo.id, branch_name)
339340

340341
app.info('${log_prefix}: ${items.len} items found in branch ${branch_name}')
342+
println(items)
341343

342344
if items.len == 0 {
343345
// No files in the db, fetch them from git and cache in db
@@ -354,6 +356,7 @@ pub fn (mut app App) tree(username string, repo_name string, branch_name string,
354356

355357
if items.any(it.last_msg == '') {
356358
// If any of the files has a missing `last_msg`, we need to refetch it.
359+
println('no last msg')
357360
app.slow_fetch_files_info(mut repo, branch_name, app.current_path) or {
358361
app.info(err.str())
359362
}
@@ -386,6 +389,8 @@ pub fn (mut app App) tree(username string, repo_name string, branch_name string,
386389

387390
// Update items after fetching info
388391
items = app.find_repository_items(repo_id, branch_name, app.current_path)
392+
println('new items')
393+
println(items)
389394

390395
dirs := items.filter(it.is_dir)
391396
files := items.filter(!it.is_dir)

src/tag.v

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ fn (mut app App) fetch_tags(repo Repo) ! {
3636
}
3737

3838
app.insert_tag_into_db(repo.id, tag_name, commit_hash, commit_message, user.id,
39-
int(commit_date.unix))!
39+
int(commit_date.unix()))!
4040
}
4141
}
4242

src/templates/tree.html

+2-1
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ <h2>About</h2>
109109
}
110110
@end
111111

112-
@if has_commits
112+
@if true || has_commits
113113
.files {
114114
.last_commit {
115115
<b>@last_commit.author</b>
@@ -132,6 +132,7 @@ <h2>About</h2>
132132
}
133133
}
134134
@end
135+
<B>START</B>
135136
@for file in items
136137
.file {
137138
span.file-ico {

src/user.v

+3-3
Original file line numberDiff line numberDiff line change
@@ -326,8 +326,8 @@ pub fn (mut app App) increment_user_post(mut user User) ! {
326326

327327
u := *user
328328
id := u.id
329-
now := int(time.now().unix)
330-
lastplus := int(time.unix(u.last_post_time).add_days(1).unix)
329+
now := int(time.now().unix())
330+
lastplus := int(time.unix(u.last_post_time).add_days(1).unix())
331331

332332
if now >= lastplus {
333333
user.last_post_time = now
@@ -376,7 +376,7 @@ fn (mut app App) change_full_name(user_id int, full_name string) ! {
376376
}
377377

378378
fn (mut app App) incement_namechanges(user_id int) ! {
379-
now := int(time.now().unix)
379+
now := int(time.now().unix())
380380

381381
sql app.db {
382382
update User set namechanges_count = namechanges_count + 1, last_namechange_time = now

src/user_routes.v

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ pub fn (mut app App) handle_update_user_settings(username string) vweb.Result {
132132
}
133133

134134
is_first_namechange := app.user.last_namechange_time == 0
135-
can_change_usernane := app.user.last_namechange_time + namechange_period <= time.now().unix
135+
can_change_usernane := app.user.last_namechange_time + namechange_period <= time.now().unix()
136136

137137
if !(is_first_namechange || can_change_usernane) {
138138
app.error('You need to wait until you can change the name again')

src/utils.v

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import math
55
import os
66

77
pub fn (mut app App) running_since() string {
8-
duration := time.now().unix - app.started_at
8+
duration := time.now().unix() - app.started_at
99

1010
seconds_in_hour := 60 * 60
1111

0 commit comments

Comments
 (0)