summaryrefslogtreecommitdiff
path: root/bootstrap-without-vcs.patch
blob: 289af123f7de4c07daa57f6ee09f494c4a9cd3ce (plain)
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
--- a/python/mozboot/mozboot/bootstrap.py
+++ b/python/mozboot/mozboot/bootstrap.py
@@ -548,11 +548,9 @@ def current_firefox_checkout(env, hg: Optional[Path] = None):
 
         if not len(path.parents):
             break
+        path = path.parent
 
-    raise UserError(
-        "Could not identify the root directory of your checkout! "
-        "Are you running `mach bootstrap` in an hg or git clone?"
-    )
+    return ("local", Path.cwd())
 
 
 def update_git_tools(git: Optional[Path], root_state_dir: Path):
--- a/python/mozversioncontrol/mozversioncontrol/__init__.py
+++ b/python/mozversioncontrol/mozversioncontrol/__init__.py
@@ -684,6 +684,29 @@ class GitRepository(Repository):
         self._run("config", name, value)
 
 
+class LocalRepository(Repository):
+
+    def __init__(self, path):
+        super(LocalRepository, self).__init__(path, tool="true")
+
+    @property
+    def head_ref(self):
+        return ""
+
+    def get_outgoing_files(self):
+        return []
+
+    def get_changed_files(self):
+        return []
+
+    def get_tracked_files_finder(self):
+        files = [os.path.relpath(os.path.join(dp, f), self.path).replace("\\","/") for dp, dn, fn in os.walk(self.path) for f in fn]
+        files.sort()
+        return FileListFinder(files)
+
+
+        
+
 def get_repository_object(path: Optional[Union[str, Path]], hg="hg", git="git"):
     """Get a repository object for the repository at `path`.
     If `path` is not a known VCS repository, raise an exception.
@@ -697,7 +720,7 @@ def get_repository_object(path: Optional[Union[str, Path]], hg="hg", git="git"):
     elif (path / ".git").exists():
         return GitRepository(path, git=git)
     else:
-        raise InvalidRepoPath(f"Unknown VCS, or not a source checkout: {path}")
+        return LocalRepository(path)
 
 
 def get_repository_from_build_config(config):
@@ -721,6 +744,8 @@ def get_repository_from_build_config(config):
         return HgRepository(Path(config.topsrcdir), hg=config.substs["HG"])
     elif flavor == "git":
         return GitRepository(Path(config.topsrcdir), git=config.substs["GIT"])
+    elif flavor == "local":
+        return LocalRepository(config.topsrcdir)
     else:
         raise MissingVCSInfo("unknown VCS_CHECKOUT_TYPE value: %s" % flavor)
 
--- a/third_party/python/taskcluster_taskgraph/taskgraph/util/vcs.py
+++ b/third_party/python/taskcluster_taskgraph/taskgraph/util/vcs.py
@@ -168,6 +168,43 @@ class GitRepository(Repository):
         self.run("checkout", ref)
 
 
+class LocalRepository(Repository):
+    tool = "true"
+
+    @property
+    def head_ref(self):
+        return ""
+
+    def get_outgoing_files(self):
+        return []
+
+    def get_changed_files(self):
+        return []
+
+    def base_ref(self):
+        raise Exception("Unimplemented")
+
+    def branch(self):
+        raise Exception("Unimplemented")
+
+    def get_commit_message(self):
+        raise Exception("Unimplemented")
+
+    def get_url(self):
+        return ""
+
+    def update(self):
+        raise Exception("Unimplemented")
+
+    def working_directory_clean(self):
+        raise Exception("Unimplemented")
+
+    def get_tracked_files_finder(self):
+        files = [os.path.relpath(os.path.join(dp, f), self.path).replace("\\","/") for dp, dn, fn in os.walk(self.path) for f in fn]
+        files.sort()
+        return FileListFinder(files)
+
+
 def get_repository(path):
     """Get a repository object for the repository at `path`.
     If `path` is not a known VCS repository, raise an exception.
@@ -178,7 +215,7 @@ def get_repository(path):
         elif os.path.exists(os.path.join(path, ".git")):
             return GitRepository(path)
 
-    raise RuntimeError("Current directory is neither a git or hg repository")
+    return LocalRepository(path)
 
 
 def find_hg_revision_push_info(repository, revision):
bgstack15