From a269b1cb9dc21dfd598bfea3766206b606ad4589 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Fri, 21 Feb 2020 00:49:41 -0500 Subject: 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 Reviewed-by: David Pursehouse --- manifest_xml.py | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'manifest_xml.py') 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): """ self.Override(name) - try: - if os.path.lexists(self.manifestFile): - platform_utils.remove(self.manifestFile) - platform_utils.symlink(os.path.join('manifests', name), self.manifestFile) - except OSError as e: - raise ManifestParseError('cannot link manifest %s: %s' % (name, str(e))) + # Old versions of repo would generate symlinks we need to clean up. + if os.path.lexists(self.manifestFile): + platform_utils.remove(self.manifestFile) + # This file is interpreted as if it existed inside the manifest repo. + # That allows us to use with the relative file name. + with open(self.manifestFile, 'w') as fp: + fp.write(""" + + + + +""" % (name,)) def _RemoteToXml(self, r, doc, root): e = doc.createElement('remote') -- cgit v1.2.3-54-g00ecf