Kiln » Kiln Extensions
Clone URL:  
Pushed to 2 repositories · View In Graph Contained in tip

Kiln 3.1.469 extensions

Changeset e12087422420

Parent 1f18453ba26a

by Profile picture of William ZimrinWilliam Zimrin

Changes to 5 files · Browse files at e12087422420 Showing diff from parent 1f18453ba26a Diff from another changeset...

Change 1 of 2 Show Entire File big-push.py Stacked
 
16
17
18
19
 
20
21
22
 
47
48
49
50
 
 
 
 
 
 
 
51
52
53
 
16
17
18
 
19
20
21
22
 
47
48
49
 
50
51
52
53
54
55
56
57
58
59
@@ -16,7 +16,7 @@
   '''automatically push large repositories in chunks'''   -from mercurial import cmdutil, commands, hg, extensions +from mercurial import cmdutil, commands, hg, extensions, exchange  from mercurial.i18n import _    max_push_size = 1000 @@ -47,7 +47,13 @@
  fci = discovery.findcommonincoming(repo, other, force=force)   outgoing = discovery.findcommonoutgoing(repo, other, onlyheads=revs, commoninc=fci, force=force)   if not force: - discovery.checkheads(repo, other, outgoing, fci[2], False) + try: + discovery.checkheads(repo, other, outgoing, fci[2], False) + except TypeError: + pushop = exchange.pushoperation(repo, other, newbranch=False) + pushop.outgoing = outgoing + pushop.remoteheads = fci[2] + discovery.checkheads(pushop)   return [True]   except ImportError:   # Mercurial 1.5 and lower
Change 1 of 3 Show Entire File kiln.py Stacked
 
242
243
244
245
 
 
 
 
 
 
 
 
246
247
 
248
249
250
 
569
570
571
572
 
573
 
 
 
 
574
575
576
 
577
578
579
580
 
581
582
583
 
657
658
659
660
661
662
663
664
665
 
 
 
 
 
666
667
668
669
670
671
672
673
674
675
676
 
242
243
244
 
245
246
247
248
249
250
251
252
253
 
254
255
256
257
 
576
577
578
 
579
580
581
582
583
584
585
586
 
587
588
589
590
 
591
592
593
594
 
668
669
670
 
 
 
 
 
 
671
672
673
674
675
676
677
 
 
 
 
 
 
678
679
680
@@ -242,9 +242,16 @@
  user = ui.prompt('username:')   pw = ui.getpass()   - token = call_api(ui, url, 'Api/1.0/Auth/Login', dict(sUser=user, sPassword=pw)) + try: + token = call_api(ui, url, 'Api/1.0/Auth/Login', dict(sUser=user, sPassword=pw)) + except APIError as e: + if 'BadAuthenticationTFA' in e.errors: + ui.write(_('Two-Factor Authentication is enabled for your account\n')) + ui.write(_('Please go into your settings page, generate an API key,\n')) + ui.write(_('and enter it here (press enter to skip)\n')) + token = ui.getpass('token: ')   - if token: + if token and token != '':   return token   raise util.Abort(_('authorization failed'))   @@ -569,15 +576,19 @@
  for tup in urls:   url = tup[1]   baseurl = get_api_url(url) - if baseurl is None or baseurl.startswith('ssh:'): + if baseurl is None:   continue + if baseurl.startswith('ssh:'): + apiurl = 'https://' + baseurl[baseurl.find('@') + 1:] + else: + apiurl = baseurl     tails = get_tails(repo) - token = get_token(repo.ui, baseurl) + token = get_token(repo.ui, apiurl)     # We have an token at this point   params = dict(revTails=tails, token=token) - related_repos = call_api(repo.ui, baseurl, 'Api/1.0/Repo/Related', params) + related_repos = call_api(repo.ui, apiurl, 'Api/1.0/Repo/Related', params)   stripped = baseurl.rstrip('/')   if not stripped.startswith('ssh:'):   stripped += "/Code" @@ -657,20 +668,13 @@
  except urllib2.HTTPError:   raise util.Abort(_('Invalid URL: %s') % url)   - def find_slug(slug, l, attr=None): - if not l: - return None - for candidate in l.get(attr) if attr else l: - if candidate['sSlug'] == slug or (slug == 'Group' and candidate['sSlug'] == ''): - return candidate + paths = url.split('/') + project, group, repo = paths[-3:] + repo = call_api(repo.ui, baseurl, 'Api/1.0/Project/%s/Group/%s/Repo/%s' % (project, group, repo), dict(token=token)) + + if 'errors' in repo:   return None   - paths = url.split('/') - kiln_projects = call_api(repo.ui, baseurl, 'Api/1.0/Project/', dict(token=token)) - project, group, repo = paths[-3:] - project = find_slug(project, kiln_projects) - group = find_slug(group, project, 'repoGroups') - repo = find_slug(repo, group, 'repos')   return repo    
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
 
 
 
 
27
28
29
30
31
32
33
34
35
 
 
 
 
36
37
38
39
40
41
42
43
44
45
 
 
 
 
46
47
 
 
 
 
48
49
 
 
 
 
50
51
 
 
 
 
52
53
 
 
 
 
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
 
26
27
28
29
30
31
32
33
34
35
36
37
 
38
39
40
41
42
43
44
45
46
47
48
49
50
 
51
52
53
54
55
 
56
57
58
59
60
 
61
62
63
64
65
 
66
67
68
69
70
 
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
 #!/usr/bin/env python  #  # Test big-push extension    import os    import hgtest    hgt = hgtest.Tester()    hgt.announce('setup')  token = hgt.gettoken()  hgt.deletetest(token)  test = hgt.createtest(token)  hgt.hg(['clone', hgt.test_url(), 'repo1'], log=False,   stdout='''no changes found  updating to branch default  0 files updated, 0 files merged, 0 files removed, 0 files unresolved  ''')  os.chdir('repo1')  hgt.writefile('n1', 'n1')  hgt.hg(['add', 'n1'])  hgt.hg(['commit', '-m', 'add file'])  hgt.hg(['push'], stdout='''pushing to %s  searching for changes -remote: kiln: successfully pushed one changeset +remote: adding changesets +remote: adding manifests +remote: adding file changes +remote: added 1 changesets with 1 changes to 1 files  ''' % hgt.test_url())  hgt.writefile('n2', 'n2')  hgt.hg(['add', 'n2'])  hgt.hg(['commit', '-m', 'add another file'])  hgt.hg(['push', '--chunked'], stdout='''pushing to %s  searching for changes  searching for changes  searching for changes -remote: kiln: successfully pushed one changeset +remote: adding changesets +remote: adding manifests +remote: adding file changes +remote: added 1 changesets with 1 changes to 1 files  ''' % hgt.test_url())  for i in range(3, 25):   hgt.writefile('n%d' % i, 'dummy')   hgt.hg(['add', 'n%d' % i])   hgt.hg(['commit', '-m', 'changeset %d' % i])  hgt.hg(['push', '--chunked'], stdout='''pushing to %s  searching for changes  searching for changes  searching for changes -remote: kiln: successfully pushed one changeset +remote: adding changesets +remote: adding manifests +remote: adding file changes +remote: added 1 changesets with 1 changes to 1 files  searching for changes -remote: kiln: successfully pushed 2 changesets +remote: adding changesets +remote: adding manifests +remote: adding file changes +remote: added 2 changesets with 2 changes to 2 files  searching for changes -remote: kiln: successfully pushed 4 changesets +remote: adding changesets +remote: adding manifests +remote: adding file changes +remote: added 4 changesets with 4 changes to 4 files  searching for changes -remote: kiln: successfully pushed 8 changesets +remote: adding changesets +remote: adding manifests +remote: adding file changes +remote: added 8 changesets with 8 changes to 8 files  searching for changes -remote: kiln: successfully pushed 7 changesets +remote: adding changesets +remote: adding manifests +remote: adding file changes +remote: added 7 changesets with 7 changes to 7 files  ''' % hgt.test_url())  hgt.hg(['pull'], stdout='''pulling from %s  searching for changes  no changes found  ''' % hgt.test_url())  hgt.hg(['push'], stdout='''pushing to %s  searching for changes  no changes found  ''' % hgt.test_url())  os.chdir('..')  hgt.hg(['clone', hgt.test_url(), 'repo2'], log=False,   stdout='''requesting all changes  adding changesets  adding manifests  adding file changes  added 24 changesets with 24 changes to 24 files  updating to branch default  24 files updated, 0 files merged, 0 files removed, 0 files unresolved  ''')  hgt.report()
 
16
17
18
19
 
 
 
20
21
22
 
31
32
33
34
 
 
 
 
16
17
18
 
19
20
21
22
23
24
 
33
34
35
 
36
37
38
@@ -16,7 +16,9 @@
 hgt.hg(['logout'])    hgt.hg(['pull'], stdin='\n\n', status=-1, - stderr='abort: http authorization required for %s' % hgt.test_url()) + stderr='abort: http authorization required for %s' % hgt.test_url(), + stdout='''pulling from %s +''' % hgt.test_url())    hgt.hg(['pull'], auth=True,   stdout='''pulling from %s @@ -31,4 +33,6 @@
 hgt.hg(['logout'])    hgt.hg(['pull'], stdin='\n\n', status=-1, - stderr='abort: http authorization required for %s' % hgt.test_url()) + stderr='abort: http authorization required for %s' % hgt.test_url(), + stdout='''pulling from %s +''' % hgt.test_url())
 
24
25
26
27
 
 
 
 
28
29
30
 
43
44
45
46
 
 
 
 
47
48
49
 
66
67
68
69
 
 
 
 
70
71
72
 
24
25
26
 
27
28
29
30
31
32
33
 
46
47
48
 
49
50
51
52
53
54
55
 
72
73
74
 
75
76
77
78
79
80
81
@@ -24,7 +24,10 @@
 hgt.hg(['commit', '-m', 'add file'])  hgt.hg(['push'], stdout='''pushing to %s  searching for changes -remote: kiln: successfully pushed one changeset +remote: adding changesets +remote: adding manifests +remote: adding file changes +remote: added 1 changesets with 1 changes to 1 files  ''' % hgt.test_url())  testbranch = hgt.createtestbranch(token, ixParent)  hgt.hg(['kiln', '-t'], '''The following Kiln targets are available for this repository: @@ -43,7 +46,10 @@
 ''' % (hgt.test_url(), hgt.test_branch_url()))  hgt.hg(['push'], stdout='''pushing to %s  searching for changes -remote: kiln: successfully pushed one changeset +remote: adding changesets +remote: adding manifests +remote: adding file changes +remote: added 1 changesets with 1 changes to 1 files  ''' % hgt.test_url())  hgt.writefile('n3', 'n3')  hgt.hg(['add', 'n3']) @@ -66,7 +72,10 @@
   hgt.hg(['push', 'TestBranch'], stdout='''pushing to %s  searching for changes -remote: kiln: successfully pushed 2 changesets +remote: adding changesets +remote: adding manifests +remote: adding file changes +remote: added 2 changesets with 2 changes to 2 files  ''' % hgt.test_branch_url())  os.chdir('..')  hgt.hg(['clone', hgt.test_url(), 'repo2'], log=False,