1
1
#!/usr/bin/env php
2
2
<?php
3
3
4
+ if (empty ($ GLOBALS ['argv ' ]['1 ' ])) {
5
+ throw new Exception ("Invalid branch name " );
6
+ }
7
+
8
+ list ($ major , $ minor ) = explode ('. ' , $ GLOBALS ['argv ' ]['1 ' ]);
9
+
4
10
define ('UPSTREAM_REPOSITORY ' , 'https://git.drupal.org/project/drupal.git ' );
5
11
define ('UPSTREAM_DIRECTORY ' , 'upstream ' );
6
12
define ('DOWNSTREAM_REPOSITORY ' , exec ('git config --get remote.origin.url ' ));
@@ -18,19 +24,19 @@ $blacklist = array(
18
24
'8.0.0-beta5 ' ,
19
25
);
20
26
21
- function filter_valid_tags ($ upstream_tags , $ blacklist ) {
27
+ function filter_valid_tags ($ upstream_tags , $ blacklist, $ major , $ minor ) {
22
28
$ tags = array ();
23
29
foreach ($ upstream_tags as $ tag ) {
24
- preg_match ('/refs\/tags\/(8\.[0-9]+ \.[0-9]+[^\^\{}\n]*)/ ' , $ tag , $ value );
30
+ preg_match ('/refs\/tags\/( ' . $ major . ' \. ' . $ minor . ' \.[0-9]+[^\^\{}\n]*)/ ' , $ tag , $ value );
25
31
if (isset ($ value [1 ]) && !in_array ($ value [1 ], $ blacklist )) {
26
32
$ tags [] = $ value [1 ];
27
33
}
28
34
}
29
35
return array_unique ($ tags );
30
36
}
31
37
32
- $ upstream_tags = filter_valid_tags ($ upstream_tags , $ blacklist );
33
- $ downstream_tags = filter_valid_tags ($ downstream_tags , $ blacklist );
38
+ $ upstream_tags = filter_valid_tags ($ upstream_tags , $ blacklist, $ major , $ minor );
39
+ $ downstream_tags = filter_valid_tags ($ downstream_tags , $ blacklist, $ major , $ minor );
34
40
35
41
// Tags thats are not in the downstream repo.
36
42
$ tags = array_diff ($ upstream_tags , $ downstream_tags );
0 commit comments