diff options
author | Mike Frysinger <vapier@google.com> | 2020-02-21 00:49:41 -0500 |
---|---|---|
committer | David Pursehouse <dpursehouse@collab.net> | 2020-02-22 04:38:17 +0000 |
commit | a269b1cb9dc21dfd598bfea3766206b606ad4589 (patch) | |
tree | 70d4344fcac2b422486046ed8394fa5c68d901c2 | |
parent | 7951e143852bd861da21253275131d1fa79714d0 (diff) | |
download | git-repo-a269b1cb9dc21dfd598bfea3766206b606ad4589.tar.gz |
manifest_xml: change .repo/manifest.xml to a plain file
Changing this to a file instead of using a symlink serves two purposes:
* We can insert some comments & doc links to help users learn what this
is for, discover relevant documentation, and to discourage them from
modifying things.
* Windows requires Administrator access to use symlinks. With this
last change, Windows users can get repo client checkouts with the new
--worktree option and not need symlinks anywhere at all. Which means
they no longer need to be an Administrator in order to `repo sync`.
Change-Id: I9bc46824fd8d4b0f446ba84bd764994ca1e597e2
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/256313
Tested-by: Mike Frysinger <vapier@google.com>
Reviewed-by: David Pursehouse <dpursehouse@collab.net>
-rw-r--r-- | docs/internal-fs-layout.md | 13 | ||||
-rw-r--r-- | manifest_xml.py | 27 |
2 files changed, 31 insertions, 9 deletions
diff --git a/docs/internal-fs-layout.md b/docs/internal-fs-layout.md index 0b6c4709..8050e4f0 100644 --- a/docs/internal-fs-layout.md +++ b/docs/internal-fs-layout.md | |||
@@ -68,13 +68,20 @@ support, see the [manifest-format.md] file. | |||
68 | If you want to switch the tracking settings, re-run `repo init` with the | 68 | If you want to switch the tracking settings, re-run `repo init` with the |
69 | new settings. | 69 | new settings. |
70 | 70 | ||
71 | * `manifest.xml`: The manifest that repo uses. It is generated at `repo init` | ||
72 | and uses the `--manifest-name` to determine what manifest file to load next | ||
73 | out of `manifests/`. | ||
74 | |||
75 | Do not try to modify this to load other manifests as it will confuse repo. | ||
76 | If you want to switch manifest files, re-run `repo init` with the new | ||
77 | setting. | ||
78 | |||
79 | Older versions of repo managed this with symlinks. | ||
80 | |||
71 | * `manifest.xml -> manifests/<manifest-name>.xml`: A symlink to the manifest | 81 | * `manifest.xml -> manifests/<manifest-name>.xml`: A symlink to the manifest |
72 | that the user wishes to sync. It is specified at `repo init` time via | 82 | that the user wishes to sync. It is specified at `repo init` time via |
73 | `--manifest-name`. | 83 | `--manifest-name`. |
74 | 84 | ||
75 | Do not try to repoint this symlink to other files as it will confuse repo. | ||
76 | If you want to switch manifest files, re-run `repo init` with the new | ||
77 | setting. | ||
78 | 85 | ||
79 | * `manifests.git/.repo_config.json`: JSON cache of the `manifests.git/config` | 86 | * `manifests.git/.repo_config.json`: JSON cache of the `manifests.git/config` |
80 | file for repo to read/process quickly. | 87 | file for repo to read/process quickly. |
diff --git a/manifest_xml.py b/manifest_xml.py index fe0735a8..a3effd11 100644 --- a/manifest_xml.py +++ b/manifest_xml.py | |||
@@ -191,12 +191,27 @@ class XmlManifest(object): | |||
191 | """ | 191 | """ |
192 | self.Override(name) | 192 | self.Override(name) |
193 | 193 | ||
194 | try: | 194 | # Old versions of repo would generate symlinks we need to clean up. |
195 | if os.path.lexists(self.manifestFile): | 195 | if os.path.lexists(self.manifestFile): |
196 | platform_utils.remove(self.manifestFile) | 196 | platform_utils.remove(self.manifestFile) |
197 | platform_utils.symlink(os.path.join('manifests', name), self.manifestFile) | 197 | # This file is interpreted as if it existed inside the manifest repo. |
198 | except OSError as e: | 198 | # That allows us to use <include> with the relative file name. |
199 | raise ManifestParseError('cannot link manifest %s: %s' % (name, str(e))) | 199 | with open(self.manifestFile, 'w') as fp: |
200 | fp.write("""<?xml version="1.0" encoding="UTF-8"?> | ||
201 | <!-- | ||
202 | DO NOT EDIT THIS FILE! It is generated by repo and changes will be discarded. | ||
203 | If you want to use a different manifest, use `repo init -m <file>` instead. | ||
204 | |||
205 | If you want to customize your checkout by overriding manifest settings, use | ||
206 | the local_manifests/ directory instead. | ||
207 | |||
208 | For more information on repo manifests, check out: | ||
209 | https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md | ||
210 | --> | ||
211 | <manifest> | ||
212 | <include name="%s" /> | ||
213 | </manifest> | ||
214 | """ % (name,)) | ||
200 | 215 | ||
201 | def _RemoteToXml(self, r, doc, root): | 216 | def _RemoteToXml(self, r, doc, root): |
202 | e = doc.createElement('remote') | 217 | e = doc.createElement('remote') |