|
|
@@ -28,23 +28,20 @@ hostname = parsed.hostname
|
|
|
if hostname == 'github.com-private':
|
|
|
hostname = 'github.com'
|
|
|
|
|
|
-if hostname == 'github.com':
|
|
|
- obj_type = 'tree'
|
|
|
- if len(sys.argv) == 2:
|
|
|
- obj_type = 'blob'
|
|
|
-
|
|
|
- repo_url = urllib.parse.urlunparse(('https', hostname, parsed.path, '', '', ''))
|
|
|
-
|
|
|
- def url_for(treeish):
|
|
|
- dir_url = '%s/%s/%s' % (repo_url, obj_type, treeish)
|
|
|
- if relpath:
|
|
|
- dir_url = '%s/%s' % (dir_url, relpath)
|
|
|
- if len(sys.argv) == 2:
|
|
|
- return '%s/%s' % (dir_url, sys.argv[1])
|
|
|
- else:
|
|
|
- return dir_url
|
|
|
-
|
|
|
- print(url_for(tracking_branch))
|
|
|
- print(url_for(commit))
|
|
|
-else:
|
|
|
- raise Exception("can't handle " + parsed.hostname)
|
|
|
+obj_type = 'tree'
|
|
|
+if len(sys.argv) == 2:
|
|
|
+ obj_type = 'blob'
|
|
|
+
|
|
|
+repo_url = urllib.parse.urlunparse(('https', hostname, parsed.path, '', '', ''))
|
|
|
+
|
|
|
+def url_for(treeish):
|
|
|
+ dir_url = '%s/%s/%s' % (repo_url, obj_type, treeish)
|
|
|
+ if relpath:
|
|
|
+ dir_url = '%s/%s' % (dir_url, relpath)
|
|
|
+ if len(sys.argv) == 2:
|
|
|
+ return '%s/%s' % (dir_url, sys.argv[1])
|
|
|
+ else:
|
|
|
+ return dir_url
|
|
|
+
|
|
|
+print(url_for(tracking_branch))
|
|
|
+print(url_for(commit))
|