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 /manifest_xml.py | |
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>
Diffstat (limited to 'manifest_xml.py')
-rw-r--r-- | manifest_xml.py | 27 |
1 files changed, 21 insertions, 6 deletions
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') |