22 opts = { |
22 opts = { |
23 :user => user, |
23 :user => user, |
24 :pass => pass, |
24 :pass => pass, |
25 } |
25 } |
26 paths = hg.paths |
26 paths = hg.paths |
27 if remote == 'upstream' |
27 remote_used = remote |
|
28 if remote_used == 'upstream' |
28 if not paths['upstream'] then |
29 if not paths['upstream'] then |
29 remote = 'canonical' |
30 remote_used = 'canonical' |
30 end |
31 end |
31 elsif remote == 'staging' |
32 elsif remote_used == 'staging' |
32 if not paths['staging'] then |
33 if not paths['staging'] then |
33 puts "" |
34 puts "" |
34 puts "!! repository #{hg.path} has not staging repository defined - skipping !!" |
35 puts "!! repository #{hg.path} has not staging repository defined - skipping !!" |
35 puts "" |
36 puts "" |
36 return |
37 return |
39 |
40 |
40 # STC and librun are special - never push them automatically |
41 # STC and librun are special - never push them automatically |
41 # to upstream / canonical repo, must be done manually. This is |
42 # to upstream / canonical repo, must be done manually. This is |
42 # mainly beacuse there are on separate protected repositories |
43 # mainly beacuse there are on separate protected repositories |
43 # not accessible without a special setup. Sigh... |
44 # not accessible without a special setup. Sigh... |
44 if (remote == 'upstream') or (remote == 'canonical') then |
45 if ((pkg.name == 'stx:stc') or (pkg.name == 'stx:librun')) and ((remote_used == 'upstream') or (remote_used == 'canonical')) then |
45 if (pkg.name == 'stx:stc') or (pkg.name == 'stx:librun') then |
46 puts "" |
|
47 puts "== Skipping push of #{pkg.name} - you must push manually ==" |
|
48 puts "" |
|
49 else |
|
50 if review_only then |
|
51 opts[:rev] = '.' |
|
52 remote_url = hg.paths[remote_used] || remote_used |
|
53 bookmark = hg.bookmark() |
46 puts "" |
54 puts "" |
47 puts "== Skipping push of #{pkg.name} - you must push manually ==" |
55 puts "== changes going to #{remote_url} ==" |
48 puts "" |
56 puts "" |
49 return |
57 hg.outgoing(remote_used, **opts) |
|
58 puts "" |
|
59 if push_bookmark and bookmark then |
|
60 puts "Will update bookmark '#{bookmark}" |
|
61 end |
|
62 puts "====================================" |
|
63 puts "" |
|
64 else |
|
65 if push_bookmark && bookmark then |
|
66 opts[:bookmarks] = ['.'] |
|
67 else |
|
68 opts[:rev] = '.' |
|
69 end |
|
70 hg.push(remote_used, **opts) |
50 end |
71 end |
51 end |
|
52 |
|
53 if review_only then |
|
54 opts[:rev] = '.' |
|
55 remote_url = hg.paths[remote] || remote |
|
56 bookmark = hg.bookmark() |
|
57 puts "" |
|
58 puts "== changes going to #{remote_url} ==" |
|
59 puts "" |
|
60 hg.outgoing(remote, **opts) |
|
61 puts "" |
|
62 if push_bookmark and bookmark then |
|
63 puts "Will update bookmark '#{bookmark}" |
|
64 end |
|
65 puts "====================================" |
|
66 puts "" |
|
67 else |
|
68 if push_bookmark && bookmark then |
|
69 opts[:bookmarks] = ['.'] |
|
70 else |
|
71 opts[:rev] = '.' |
|
72 end |
|
73 hg.push(remote, **opts) |
|
74 end |
72 end |
75 end |
73 end |
76 end |
74 end |
77 |
75 |
78 desc "Display changes to be pushed to upstream repositores (use it to review what workflow:push-upstream would do)" |
76 desc "Display changes to be pushed to upstream repositores (use it to review what workflow:push-upstream would do)" |