project.py: Replace the relpath function with os.path.relpath

Change-Id: Ib313340344968211cecfc0a718f6072e41da1a91
Omit all default groups when generating a manifest

One of the recent changes introduced implicit path:xxx and name:xxx groups
to every project, however they are not being stripped when generating
a manifest using "repo manifest" command resulting in clutter

Change-Id: Iec8610ba794b2fe4a6cdf0f59ca561595b66f9b5
Merge branch 'master' into maint

master's original purpose was to forge ahead on using git submodules,
but this route has been abandoned.

Change-Id: I164a9efc7821bcd1b941ad76649764722046081b
Patches should be submitted to master, not maint

Update SUBMITTING_PATCHES accordingly.

Change-Id: I6fd57a84c67d3762f1f23276d95cac2aeecd5e8f
manifest-format.txt: Fix a couple of minor spelling mistakes

Change-Id: Ic2d266c8cf08827a71846db9d3711feb02885f01
Remove unused imports

There are several imports that are not used.  Remove them.

Change-Id: I2ac3be66827bd68d3faedcef7d6bbf30ea01d3f2
init: Improved help text for the --mirror option

Change-Id: Ia6032865f9296b29524c2c25b72bd8e175b30489
`repo manifest`: default to stdout if no "-o"

Change-Id: I1b0ff9ed5df6386f0c2a851c6c48d063199fe663
manifest-format.txt: Add documentation for GetManifest RPC method

Add documentation of the GetManifest RPC method in the
manifest-server section.

Change-Id: I5cda5929bc8a0ca9d3f2b9da63216427041d2823
Make "repo sync -j<count>" stop properly on Ctrl-C.

The threaded 'repo sync' implementation would very often freeze the
process when interrupted by the user with Ctrl-C. The only solution
being to kill -9 the process explicitly from another terminal.

The reason for this is best explained here:

http://snakesthatbite.blogspot.fr/2010/09/cpython-threading-interrupting.html

This patch makes all helper sync threads 'daemon', which allows the
process to terminate immediately on Ctrl-C.

Note that this will forcefully kill all threads in case of interruption; this
is generally a bad thing, but:

  1/ This is equivalent to calling kill -9 in another terminal, which
     is the _only_ thing that can currently stop the process.

  2/ There doesn't seem to be a way to tell the worker threads to
     gently stop when they are in a blocking operation anyway (even
     in the non-threaded case).

+ Do the same for "repo status -j<count>".

Change-Id: Ieaf45b0eacee36f35427f8edafd87415c2aa7be4
Allow projects to be specified as notdefault

Instead of every group being in the group "default", every project
is now in the group "all".   A group that should not be downloaded
by default may be added to the group "notdefault".

This allows all group names to be positive (instead of removing groups
directly in the manifest with -default) and offers a clear way of
selecting every project (--groups all).

Change-Id: I99cd70309adb1f8460db3bbc6eff46bdcd22256f
Fix errors when clone.bundle missing on server

Catch curl failures to download clone.bundle; don't let git try to parse
the 404 page as a bundle file (was causing much user confusion).

This should eliminate false error messages from init and sync such as:
  error: '.repo/manifests.git/clone.bundle' does not look like a v2 bundle file
  fatal: Could not read bundle '.repo/manifests.git/clone.bundle'.
  error: RPC failed; result=22, HTTP code = 400

Signed-off-by: Matt Gumbel <matthew.k.gumbel@intel.com>
Change-Id: I7994f7c0baecfb45bb5a5850c48bd2a0ffabe773
sync: catch exceptions when connecting to the manifest server

When connecting to the manifest server, exceptions can occur but
are not caught, resulting in the repo sync exiting with a python
traceback.

Add handling of the following exceptions:

- IOError, which can be raised for example if the manifest server
URL is malformed.
- xmlrpclib.ProtocolError, which can be raised if the connection
to the manifest server fails with HTTP error.
- xmlrpclib.Fault, which can be raised if the RPC call fails for
some other reason.

Change-Id: I3a4830aef0941debadd515aac776a3932e28a943
sync: Correct imports of `R_HEADS` and `HEAD`

`R_HEADS` is imported twice, from both the git_refs and project
modules.

It is actually defined in git_refs, and in project it is imported
from there, so the import of `R_HEADS` from project in the sync
module is redundant.  Remove it.

`HEAD` is imported from project, but like `R_HEADS` it is actually
defined in git_refs.  Import it from git_refs instead.

Change-Id: I8e2b0217d0d9f9f4ee5ef5b8cd0b026174ac52f4
Fix ManifestParseError when first child node is comment

If the first line of manifest.xml is a XML comment, root.childNodes[0]
is not a 'manifest' element node. The python minidom module will makes
a 'Comment' node as root.childNodes[0]. Since the original code only
checks whether the first child node is 'manifest', it couldn't do any
command including 'sync' due to the 'ManifestParseError' exception. This
patch could allow the comments between '<?xml ...?>' and '<manifest>' in
the manifest.xml file.

Change-Id: I0b81dea4f806965eca90f704c8aa7df49c579402
Fix commit-msg hook to work with 'git commit -v'
[HACK] Call my handy script after sync