Commit Graph

1685 Commits

Author SHA1 Message Date
David Pursehouse
de50d81c91 Disable warning about locally disabling pylint warnings
Several files have local suppression of pylint warnings.  We don't
need these to be reported; code review should catch any unnecessary
suppressions.

Change-Id: Ie71ba3e910714ef3fe44554a71bb62519d0a891d
2013-05-15 18:06:06 +09:00
Victor Boivie
2b30e3aaba Use reference also for manifest git
When running 'repo init --reference=<mirror>', the mirror will be
used for all projects except the manifest project. This is because
the _InitGitDir function uses the 'repo.reference' git config
value specified in the manifest git, which has no effect when
creating the manifest git as that value will be set after the git
has been successfully cloned.

Information about where the manifest git is located on the server
is only known when performing the 'repo init', so that information
has to be provided when cloning the git in order for it to set up
a proper mapping.

Change-Id: I47a2c8b3267a4065965058718ce1def4ecb34d5a
Signed-off-by: Chirayu Desai <cdesai@cyanogenmod.org>
2013-05-12 17:49:28 +05:30
David Pursehouse
793f90cdc0 Merge "Re-initialise repos git hooks when updating the forest" 2013-05-09 08:36:12 +00:00
David Pursehouse
d503352b14 Merge "Repo should not fetch tags for shallow projects" 2013-05-08 18:40:57 +00:00
Jimmie Wester
2f992cba32 Repo should not fetch tags for shallow projects
Fetching all tags for a shallow git results in an
inconstent git and forces git to fetch more than
the depth specified.

This change teaches repo not to fetch any tags in a
repository initialised with the depth option.

Change-Id: I557ead9f88fa0d6a19b1cb55b23bba1100fcb8f2
Signed-off-by: Patrik Ryd <patrik.ryd@stericsson.com>
2013-05-08 06:54:10 +01:00
David Pursehouse
b5267f9ad2 stage: replace filter on lambda with list comprehension
To fix the pylint warning:

  W0110: map/filter on lambda could be replaced by comprehension

Change-Id: Ib914b42992bb2fbfe888a68fb7b05a7695565b63
2013-05-08 06:37:15 +01:00
Conley Owens
45401230cf Merge "Optimise regex pattern compilation in FindProjects" 2013-05-07 20:08:13 +00:00
David Pursehouse
56f4eea26c Disable pylint warnings about similar lines in multiple files
When running pylint over the entire code base, it reports the
warning:

  R0801:  Similar lines in 2 files

for several pairs of files.

The code referred to is boilerplate code related to imports and
error handling.  It is not practical to change the code to avoid
the warnings, so simply disable them in the config.

Change-Id: Ie685fdf1cab60fb8f1503be560166a14058698d8
2013-05-04 21:40:56 +09:00
David Pursehouse
f385d0ca09 Disable warnings related to imports in pylint config
There are several modules that have imports to support various
versions of Python.  Pylint reports the following errors when
run in a version of Python that does not have the module or the
method/class in the module.

  F0401: Unable to import 'module'
  E0611: No name 'name' in module 'module'

Disable these warnings to reduce the noise on the output.

Change-Id: I97e7e2698bccb1e501a45a0869f97f90d54adfb7
2013-05-03 22:10:26 +09:00
David Pursehouse
84c4d3c345 Optimise regex pattern compilation in FindProjects
Make a list of compiled patterns once, and then iterate over that
per project, instead of compiling the patterns again on every project.

Change-Id: I91ec430d3060ec76d5e6b61facf6b13e343c90a7
2013-04-30 11:12:01 +09:00
Zhiguang Li
a8864fba9f Add regex support for subcommand forall
Filter the project list based on regex or wildcard matching
of strings, then we can handle subset of all projects.

Change-Id: Ib6c23aec79e7d981f7b6a5eb0ae93c44effec467
Signed-off-by: Zhiguang Li <muzili@gmail.com>
2013-04-29 16:19:26 +05:30
David Pursehouse
275e4b727a Merge "Set correct name in PyDev and Eclipse project config" 2013-04-20 05:11:05 +00:00
Conley Owens
c4c01f914c Merge "Some fixes for supporting python3" 2013-04-19 15:31:29 +00:00
David Pursehouse
9d5bf60d3c Set correct name in PyDev and Eclipse project config
The name of the project is shown as "repo" in the project list in
the Eclipse workspace.

This change renames it to "git-repo" to match the name of the git
repository.

The existing project in Eclipse must be removed (it is not necessary
to delete project contents on disk) and re-imported for the change to
take effect.

Change-Id: I2ac022d22f46e5361dfe49c0dbcad482aaefe628
2013-04-19 09:35:43 +09:00
Chirayu Desai
217ea7d274 Some fixes for supporting python3
* Fix imports.
* Use python3 syntax.
* Wrap map() calls with list().
* Use list() only wherever needed.
  (Thanks Conley!)
* Fix dictionary iteration methods
  (s/iteritems/items/).
* Make use of sorted() in appropriate places
* Use iterators directly in the loop.
* Don't use .keys() wherever it isn't needed.
* Use sys.maxsize instead of sys.maxint

TODO:
* Make repo work fully with python3. :)

Some of this was done by the '2to3' tool [1], by
applying the needed fixes in a way that doesn't
break compatibility with python2.

Links:
[1]: http://docs.python.org/2/library/2to3.html

Change-Id: Ibdf3bf9a530d716db905733cb9bfef83a48820f7
Signed-off-by: Chirayu Desai <cdesai@cyanogenmod.org>
2013-04-18 21:35:49 +05:30
Chirayu Desai
51813dfed1 repo: add rudimentary version checking
Change-Id: I957775c7ce0821971cc2320597e1a7a31950bcf3
Signed-off-by: Chirayu Desai <cdesai@cyanogenmod.org>
2013-04-17 13:43:10 +05:30
Chirayu Desai
fef4ae74e2 sync: be more verbose
* Print project name if the "quiet" option is not used.

Change-Id: I99863bb50f66e4dcbaf2d170bdd05971f2a4e19a
Signed-off-by: Chirayu Desai <cdesai@cyanogenmod.org>
2013-04-15 13:38:49 +05:30
Scott Fan
db83b1b5ab Allow mirror to be created in directories specified by 'path' attribute
In some cases, especially when local manifest files exist, users may want
to force the mirrored repositories to be created in folders according to
their 'path' attribute in the manifest, rather than according to the name
of the repositories.

To enable this functionality for specified mirror, add a new attribute
'force-path' for that project in the manifest, set its value to 'true'.

Change-Id: I61df8c987a23d84309b113e7d886ec90c838a6cc
Signed-off-by: Scott Fan <fancp2007@gmail.com>
2013-04-11 08:59:09 +08:00
David Pursehouse
ede7f12d4a Allow clone depth to be specified per project
If the clone-depth attribute is set on a project, its value will
be used to set the depth when fetching the git.  The value, if
given, must be a positive integer.

The value in the clone-depth attribute overrides any value given to
repo init via the --depth command line option.

Change-Id: I273015b3724213600b63e40cca4cafaa9f782ddf
2013-04-10 09:17:50 +09:00
Chirayu Desai
04d84a23fd list: add name-only and path-only options
`repo list -n` prints only the name of the projects.
`repo list -p` prints only the path of the projects.

Change-Id: If7d78eb2651f0b1b2fe555dc286bd2bdcad0d56d
Signed-off-by: Chirayu Desai <cdesai@cyanogenmod.org>
2013-04-06 14:39:03 +05:30
David Holmer
0a1c6a1c16 Special handling for manifest group "default"
Change Details:
* Make "default" a special manifest group that matches any project that
  does not have the special project group "notdefault"
* Use "default" instead of "all,-notdefault" when user does not specify
  manifest group
* Expand -g option help to include example usage of manifest groups

Change Benefits:
* Allow a more intuitive and expressive manifest groups specification:
  * "default" instead of "all,-notdefault"
  * "default,foo" instead of "all,-notdefault,foo"
  * "default,-foo" instead of "all,-notdefault,-foo"
  * "foo,-default" which has no equivalent
* Default manifest groups behavior can be restored by the command
  'repo init -g default'. This is significantly more intuitive than the
  current equivalent command 'repo init -g all,-notdefault'.

Change-Id: I6d0673791d64a650110a917c248bcebb23b279d3
2013-04-03 22:27:45 +00:00
Brian Harring
33e0456737 Fix repo manifest support of remote aliases.
Long story short, w/out this modification the manifest dump points
at the alias, rather than the actual remote for the project.  This
breaks sync'ing for scenarios where the alias doesn't have the same
repos available as the remote, plus just plain is wrong.

Change-Id: I7150e449341ed8655d398956a095261978d95870
2013-04-03 20:54:49 +00:00
Tim Kilbourn
07669002cb Reload the correct manifest during sync.
Fix for issue #134
https://code.google.com/p/git-repo/issues/detail?id=134

Change-Id: I94c2dea5dd63917e3f9c90cbd628921d7d61b12a
2013-03-08 16:19:03 -08:00
Jimmie Wester
a0444584cb Re-initialise repos git hooks when updating the forest
Repo now re-initialises the git-hooks reference directory
when updating the forest. This allows for any new template
files to be made available throughout the project forest
when updating the forest. Previous functionality required
the user to recreate the forest.

Change-Id: I9051265028a9e77d6139791547fff095bc195077
Signed-off-by: Patrik Ryd <patrik.ryd@stericsson.com>
2013-03-08 09:09:04 +01:00
Chirayu Desai
3cba0b8613 Add repoc to the .gitignore file
This is currently the only generated file not present in the .gitignore

Apparently it comes from the usage of the "imp" module in main.py

Change-Id: I685dc252d0c822818434a8e5f493f77b63a66f03
Signed-off-by: Chirayu Desai <cdesai@cyanogenmod.org>
2013-03-08 01:18:08 +00:00
David Pursehouse
a27852d0e7 Merge "Add manifest groups to the output of info" 2013-03-08 01:12:56 +00:00
Conley Owens
61ac9ae090 Add manifest groups to the output of info
List the user's manifest groups when running `repo info`.

These groups are passed to `repo init` using the -g/--groups flag.

Change-Id: Ie8a4ed74a35b8b90df3b1ee198fe725b1cd68ae7
2013-03-07 09:47:29 -08:00
David Pursehouse
3ee6ffd078 Merge "Fix: Missing spaces in printed messages" 2013-03-06 00:46:45 +00:00
David Pursehouse
28db6ffef4 Merge "Fix: local manifest deprecation warning appears more than once" 2013-03-06 00:46:20 +00:00
David Pursehouse
2f9e7e40c4 Fix: Missing spaces in printed messages
Several messages are printed with the `print` method and the message
is split across two lines, i.e.:

 print('This is a message split'
       'across two source code lines')

Which causes the message to be printed as:

 This is a message splitacross two source code lines

Add a space at the end of the first line before the line break:

 print('This is a message split '
       'across two source code lines'

Also correct a minor spelling mistake.

Change-Id: Ib98d93fcfb98d78f48025fcc428b6661380cff79
2013-03-05 17:30:59 +09:00
Shawn Pearce
45d21685b9 upload: support --re and --cc options over HTTP
HTTP can't use the older style of passing options as part of
the git receive-pack command line. Use the new style as defined
by https://gerrit-review.googlesource.com/42652 when connecting
over HTTP.

If the Gerrit server is too old to understand the % option
syntax used here one of two outcomes is possible:

- If no topic name was sent the server will fail with an error
  message. This happens because the user tried to do an upload to
  "refs/for/master%r=alice", and the branch does not exist.
  The user can delete the options and retry the upload.

- If a topic was set the options will be read as part of the
  topic string and shown on the change page in the topic field.

Either outcome is slightly better than the current behavior of
just dropping the data on the floor and forgetting whatever the
user tried to supply.

Change-Id: Ib2df62679e5bf3ee93d6b18c12ab6474f96d9106
2013-02-28 12:10:31 -08:00
Mitchel Humpherys
597868b4c4 Add --no-tags option to prevent fetching of tags
Add an option to pass `--no-tags' to `git fetch'.

Change-Id: I4158cc369773e08e55a167091c38ca304a197587
Signed-off-by: Mitchel Humpherys <mitchelh@codeaurora.org>
2013-02-27 11:00:49 +09:00
Olof Johansson
75b4c2deac Fix crash in repo info when % is used in commit messages
Fix for issue #131
http://code.google.com/p/git-repo/issues/detail?id=131

Change-Id: I078533ab5f3a83154c4ad6aa97a5525fc5139d20
2013-02-26 16:05:26 +09:00
Olof Johansson
b75415075c Add nofmt_printer to color.py
The current printer always expands on the arguments which is a problem
for strings containing %.

Instead of forcing manual string expansion before printing allow for a
no format printer option which simply accepts and prints the string.

Part of fix for issue #131:
http://code.google.com/p/git-repo/issues/detail?id=131

Change-Id: I08ef94b9c4ddab58ac12d2bd32ebd2c413e4f83b
2013-02-26 16:04:55 +09:00
David Pursehouse
4eb285cf90 Fix: local manifest deprecation warning appears more than once
When running repo sync, the local_manifest.xml deprecation warning
is shown twice.

Add a flag to ensure that it is only displayed once.

Change-Id: Icfa2b0b6249c037c29771f9860252e6eda3ae651
2013-02-17 21:23:33 +09:00
David Pursehouse
5f434ed723 Exit with fatal error if local manifest file cannot be parsed
If the .repo/local_manifests folder includes a local manifest file
that cannot be parsed, the current behaviour is to catch the parse
exception, print a warning, and continue to process remaining files.

This can cause any errors to go unnoticed.

Remove the exception handling, so that the exception is instead
caught in main._Main, and repo exits with a fatal error.

Change-Id: I75a70b7b850d2eb3e4ac99d435a4568ff598b7f4
2013-02-17 21:20:20 +09:00
David Pursehouse
606eab8043 Show full path of local_manifests folder in deprecation warning
When a local_manifest.xml file is present, a deprecation warning
is printed telling the user to put local manifest files in the
`local_manifests` directory.

Include the full path to the `local_manifests` directory in the
warning, to reduce confusion about where the directory should be
located.  Also enclose the directory name in backticks.

Change-Id: I85710cfbd6e77fb2fa6b7b0ce66d77693ccd649f
2013-02-17 21:19:58 +09:00
David Pursehouse
cd07cfae1c Merge "Protect line endings in shell scripts" 2013-02-14 07:51:36 +00:00
David Pursehouse
55693aabe5 Update the commit-msg hook to the version from Gerrit 2.5.2
Change-Id: I00760fe55a0e1b61375a378c05f263e7bc857ca0
2013-02-13 09:56:09 +09:00
Conley Owens
23bd3a1dd3 Add missing sys module when referencing stderr
`repo cherry-pick` was broken because we were referencing stderr
instead of sys.stderr.  This should fix it.

Change-Id: I67f25c3a0790d029edc65732c319df7c684546c8
2013-02-12 13:46:14 -08:00
Mats Bengtsson
bbf71fe363 Protect line endings in shell scripts
Add a .gitattributes file to prevent /bin/sh scripts from
getting clobbered by git config core.autocrlf=true setting.

Change-Id: I3dfc992a9c275fceae64c9719168d81e60d911bd
2013-02-11 22:13:39 +01:00
David Pursehouse
91f011ab0d Merge "Don't exit with error on HTTP 403 when downloading clone bundle" 2013-02-04 10:58:48 +00:00
David Pursehouse
87b9d9b4f2 Don't exit with error on HTTP 403 when downloading clone bundle
If the server returns HTTP 403 (forbidden) when attempting to
download clone bundle files, ignore it and continue, rather than
exiting with a fatal error.

Change-Id: Icf78cba0332b51b0e7b622f7c7924369b551b6f6
2013-01-31 21:12:08 +09:00
Olof Johansson
57bd7b717b Fix: GitError when using repo info -d
If a workspace is initialised with:

 repo init -u git://path/to/manifest -b manifest-branch

and the default.xml specifies the default revision as `other-branch`,
running `repo info -d` results in a GitError:

  fatal: bad revision 'refs/remotes/m/other-branch..'

The repo info command uses the default revision to build the symlink
to the remote revision which is passed to the `git rev-list` command.

This is incorrect; the manifest's branch name should be used.

Change-Id: Ibae5b91869848276785facfaef433e38d49fd726
2013-01-29 18:18:20 +09:00
David Pursehouse
4e46520362 Add missing manifest format documentation
Documentation of the "sync-j", "sync-c", "sync-s" and "upstream"
attributes is missing/incomplete.  Add it.

Change-Id: I74977f819f603c520ef3818f85c3b51399cd2b94
2013-01-29 10:09:21 +09:00
Will Richey
63d356ffce 'repo status --orphans' shows non-repo files
'repo status --orphans' searches for non-repo objects
(not within a project), which is particularly helpful
before removing a working tree.

Change-Id: I2239c12e6bc0447b0ad71129551cb50fa671961c
2013-01-29 10:01:53 +09:00
David Pursehouse
35765966bf Fix: missing space in information message after repo init
In the information message displayed after running repo init, there
is a missing space:

  If this is not the directory in which you want to initializerepo

Add a space.

Change-Id: I20467673ba7481cfe782ba58ff6ed2f7ce9824a5
2013-01-29 09:52:22 +09:00
David Pursehouse
254709804d Better error message when using --mirror in existing workspace
If repo init is run with the --mirror option, repo checks if there
is already a workspace initialized in the current location, and if
so, exits with an error message:

  --mirror not supported on existing client

This error can cause confusion; the users do not understand what
is wrong and what they need to do to fix it.

Change the error message to make it a bit clearer.

Change-Id: Ifd06ef64fd264bd1117e4184c49afe0345b75d8c
2013-01-29 09:47:07 +09:00
David Pursehouse
e0b6de32f7 Fix: missing spaces in info command output
Text should be joined with " " rather than "" in the output.

Change-Id: I6c5dddc15743e98c3b43702cb5d3ec32f81c3221
2013-01-29 00:02:46 +00:00
Shawn Pearce
4baf87f92c Merge "should use os.path.lexist instead of os.path.exist" 2013-01-28 16:25:55 +00:00