4

How can I avoid fetching of .repo/manifest.xml (which is modified intentionally)? I do not want to get it modified during a repo sync.

  1. I have done a repo init, This step is completed.
  2. I did a small modification on the manifest.xml, removed some projects which are not required for a sync.
  3. When we go for a repo sync, it fetches the repo and removing the modifications done in step 2.

How to avoid this fetching of manifest? Purpose is to avoid syncing of some st of projects defined in the manifest.xml

DanThoms
  • 41
  • 1
  • 4
  • as I know `repo sync` does not update .repo/manifests, but `repo init` does. So did you always run `repo init` before every `repo sync`? – ElpieKay May 19 '16 at 13:53
  • 1
    No, I did not do this, I did "repo sync -c". But I can see its fetching in the first step and my modification is getting overwritten , XXXXX@WUH1000015754:~/XXX$ repo sync -c Fetching project repo – DanThoms May 19 '16 at 13:57
  • Sorry, I tried and `repo sync` did update .repo/manifests. Two solutions: 1) `cd .repo/;ls -alF;` to find which manifest links to .repo/manifest.xml. It's some file in .repo/manifests/. Copy it out somewhere else. Modify it as you want. Exit and save. Run `repo sync -c -m full_path_of_the_modified_manifest` 2) modify .repo/manifest.xml;`cd .repo/manifests/;git add .;git commit;git pull origin --rebase;git push origin HEAD:some_proper_branch;`, go back to the root folder and run `repo sync -c -m manifest_relative_path_to_.repo/manifests`. If the manifest is default.xml, -m xxx can be omitted. – ElpieKay May 19 '16 at 14:08
  • PS. In 2), if the manifest is default.xml, do not modify it directly. You could copy it and name it another name, for example `cp default.xml my.xml`. Modify my.xml and git add, commit, pull --rebase and push it. And then you could `repo sync -c -m my.xml`. Of course, if you want to modify default.xml with intent, you could just update it instead of making my.xml. – ElpieKay May 19 '16 at 14:14
  • Thanks a lot, it is working. Sync is in progress will update once it is done. repo sync -c -m manifest_relative_path_to_.repo/manifests – DanThoms May 19 '16 at 14:27
  • Glad it helps. Just FYI, you could plus `-j N` in `repo sync` to make it faster. I usually use `-j12`, and most of the time also plus `--no-tags` since tags are always useless in my daily work. – ElpieKay May 19 '16 at 14:36
  • Thanks a lot for your suggestions... – DanThoms May 20 '16 at 04:15

2 Answers2

5

Slightly delayed answer I guess, but since a couple of months back on master and stable, repo supports "repo sync --no-manifest-update" or "repo sync --nmu" as a shorter form.

This will fetch from server, and update your workspace, without touching your manifest files.

You can have changes, be behind head, have checked out a commit hash from history somewhere, and your workspace will still get exactly that with no changes done to the manifest files or "helpful" branch switching or similar.

It will detach you, but if you run ordinary repo sync without the flags, it will put you right back. I typically use git fetch, then git checkout origin/something and then repo sync --nmu to get latest again.

Before this feature got added, you could also use repo init "specific hash" but I always thought that was more cumbersome to use, so I go with --nmu whenever I need to be sure that a sync/update won't mess up my current state.

2

Clone your manifest repo somewhere on your local machine (clone it as bare repository. use --bare option with 'git clone') and while initializing tree (repo init -u ....) specify your local path for the manifest repo.

if you have cloned your manifest repo at "/home/manifest.git" your repo init command would be

 repo init -u /home/manifest.git -m < manifest_name > -b < branch_name >
mrutyunjay
  • 6,850
  • 7
  • 25
  • 35