external/tools/repo.git
3 years agoMerge branch 'stable' master
Shawn O. Pearce [Mon, 10 Jan 2011 21:28:22 +0000 (13:28 -0800)]
Merge branch 'stable'

* stable:
  Fix mirror clients with no worktree

3 years agoFix mirror clients with no worktree 06/20306/1
Shawn O. Pearce [Mon, 10 Jan 2011 21:26:01 +0000 (13:26 -0800)]
Fix mirror clients with no worktree

Commit "Make path references OS independent" (df14a70c45)
broke mirror clients by trying to invoke replace() on None
when there is no worktree.

Change-Id: Ie0a187058358f7dcdf83119e45cc65409c980f11

3 years agoMerge branch 'stable'
Shawn O. Pearce [Mon, 10 Jan 2011 17:02:23 +0000 (09:02 -0800)]
Merge branch 'stable'

* stable:
  Bump repo version to 1,10

3 years agoBump repo version to 1,10
Shawn O. Pearce [Mon, 10 Jan 2011 17:01:24 +0000 (09:01 -0800)]
Bump repo version to 1,10

Change-Id: Ifdc041e7152af31de413b9269f20000acd945b3b

3 years agoMerge branch 'maint'
Shawn O. Pearce [Mon, 10 Jan 2011 01:39:30 +0000 (17:39 -0800)]
Merge branch 'maint'

* maint:
  help: Don't show empty Summary or Description sections
  sync: Run `git gc --auto` after fetch
  Add "repo branch" as an alias for "repo branches"
  upload: Catch and cleanly report connectivity errors
  forall: Silently skip missing projects
  Fix to display the usage message of the command download when the user don't provide any arguments to 'repo download'.
  Use os.environ.copy() instead of dict()
  Make path references OS independent

3 years agohelp: Don't show empty Summary or Description sections
Shawn O. Pearce [Thu, 4 Jun 2009 00:43:16 +0000 (17:43 -0700)]
help: Don't show empty Summary or Description sections

Signed-off-by: Shawn O. Pearce <sop@google.com>
(cherry picked from commit 60e679209a5495393ef584efaaad287fc8b77c51)

3 years agosync: Run `git gc --auto` after fetch
Shawn O. Pearce [Fri, 3 Jul 2009 22:22:49 +0000 (15:22 -0700)]
sync: Run `git gc --auto` after fetch

Users may wind up with a lot of loose object content in projects they
don't frequently make changes in, but that are modified by others.

Since we bypass many git code paths that would have otherwise called
out to `git gc --auto`, its possible for these projects to have
their loose object database grow out of control.  To help prevent
that, we now invoke it ourselves during the network half of sync.

Signed-off-by: Shawn O. Pearce <sop@google.com>
(cherry picked from commit 1875ddd47c0bf38e5cc52e1e5875caabce2d8742)

3 years agoAdd "repo branch" as an alias for "repo branches"
Mike Lockwood [Tue, 14 Jul 2009 19:23:39 +0000 (15:23 -0400)]
Add "repo branch" as an alias for "repo branches"

For those of us that are used to typing "git branch".

Signed-off-by: Mike Lockwood <lockwood@android.com>
(cherry picked from commit 33f0e786bb35ea11da1e3d1746c431da5f1d93eb)

3 years agoupload: Catch and cleanly report connectivity errors
Shawn O. Pearce [Sun, 23 Aug 2009 01:39:49 +0000 (18:39 -0700)]
upload: Catch and cleanly report connectivity errors

Instead of giving a Python backtrace when there is a connectivity
problem during repo upload, report that we cannot access the host,
and why, with a halfway decent error message.

Bug: REPO-45
Change-Id: I9a45b387e86e48073a2d99bd6d594c1a7d6d99d4
Signed-off-by: Shawn O. Pearce <sop@google.com>
(cherry picked from commit d2dfac81ad6a060179b4b2289060af2dc7a5cdfd)

3 years agoforall: Silently skip missing projects
Shawn O. Pearce [Sun, 23 Aug 2009 01:50:45 +0000 (18:50 -0700)]
forall: Silently skip missing projects

If a project is missing locally, it might be OK to skip over it
and continue running the same command in other projects.

Bug: REPO-43
Change-Id: I64f97eb315f379ab2c51fc53d24ed340b3d09250
Signed-off-by: Shawn O. Pearce <sop@google.com>
(cherry picked from commit d4cd69bdef28c5a9287c85c48a18ce621eba689d)

3 years agoFix to display the usage message of the command download when the user
Thiago Farina [Wed, 9 Sep 2009 04:41:34 +0000 (00:41 -0400)]
Fix to display the usage message of the command download when the user
don't provide any arguments to 'repo download'.

Signed-off-by: Thiago Farina <thiago.farina@gmail.com>
(cherry picked from commit 840ed0fab7cb4c2ab296c7d7d45f13e2523bae1c)

3 years agoUse os.environ.copy() instead of dict()
Shawn O. Pearce [Tue, 7 Dec 2010 16:46:14 +0000 (08:46 -0800)]
Use os.environ.copy() instead of dict()

Signed-off-by: Shawn O. Pearce <sop@google.com>
(cherry picked from commit 3218c13205694434edb2375ab8a8515554eed366)

3 years agoMake path references OS independent
Anthony Newnam [Mon, 10 Jan 2011 01:31:57 +0000 (17:31 -0800)]
Make path references OS independent

Change-Id: I5573995adfd52fd54bddc62d1d1ea78fb1328130
(cherry picked from commit b0f9a02394779c1c9422a9649412c9ac5fb0f12f)

Conflicts:

command.py

3 years agoMerge branch 'stable'
Shawn O. Pearce [Mon, 10 Jan 2011 01:29:50 +0000 (17:29 -0800)]
Merge branch 'stable'

* stable:
  Encode the environment variables passed to git
  Exit with statuscode 0 for repo help init

3 years agoEncode the environment variables passed to git 19/19219/5
Shawn O. Pearce [Tue, 7 Dec 2010 19:41:05 +0000 (11:41 -0800)]
Encode the environment variables passed to git

Windows allows the environment to have unicode values.
This will cause Python to fail to execute the command.

Change-Id: I37d922c3d7ced0d5b4883f0220346ac42defc5e9
Signed-off-by: Shawn O. Pearce <sop@google.com>
3 years agoExit with statuscode 0 for repo help init 32/20132/2
Trond Norbye [Mon, 3 Jan 2011 10:35:15 +0000 (11:35 +0100)]
Exit with statuscode 0 for repo help init

The complete help text is printed, so the program executed successfully.

Some tools (like OpenGrok) detects the availibility of a program by
running it with a known set of options and check the return code.
It is an easy and portable way of checking for the existence of a program
instead of searching the path (and handle extensions) ourselves.

Change-Id: Ic13428c77be4a36d599ccb8c86d893308818eae3

3 years agoMerge branch 'stable'
Shawn O. Pearce [Wed, 22 Dec 2010 22:46:15 +0000 (14:46 -0800)]
Merge branch 'stable'

* stable:
  Fixed race condition in 'repo sync -jN' that would open multiple masters.

3 years agoFixed race condition in 'repo sync -jN' that would open multiple masters. 16/19616/1
Doug Anderson [Tue, 21 Dec 2010 21:39:23 +0000 (13:39 -0800)]
Fixed race condition in 'repo sync -jN' that would open multiple masters.

This fixes the SSH Control Masters to be managed in a thread-safe
fashion.  This is important because "repo sync -jN" uses threads to
sync more than one repository at the same time.  The problem didn't
show up earlier because it was masked if all of the threads tried to
connect to the same host that was used on the "repo init" line.

3 years agoMerge branch 'stable' 93/19393/1
Shawn O. Pearce [Tue, 7 Dec 2010 18:31:19 +0000 (10:31 -0800)]
Merge branch 'stable'

* stable: (33 commits)
  Added feature to print a <notice> from manifest at the end of a sync.
  sync: Use --force-broken to continue other projects
  upload: Remove --replace option
  sync --quiet: be more quiet
  sync: Enable use of git clone --reference
  Only delete corrupt pickle config files if they exist
  Don't allow git fetch to start ControlMaster
  Check for existing SSH ControlMaster
  Fix for handling values of EDITOR which contain a space.
  upload: Fix --replace flag
  rebase: Pass through more options
  upload: Allow review.HOST.username to override email
  upload -t: Automatically include local branch name
  Warn users before uploading if there are local changes
  sync: Try fetching a tag as a last resort before giving up
  rebase: Automatically rebase branch on upstrea
  upload: Automatically --cc folks in review.URL.autocopy
  Fix format string bugs in grep
  Do not invoke ssh with -p argument when no port has been specified.
  Allow files to be copied into new folders
  ...

Conflicts:
git_config.py
manifest_xml.py
subcmds/init.py
subcmds/sync.py
subcmds/upload.py

Change-Id: I4756a6908277e91505c35287a122a775b68f4df5

3 years agoUse os.environ.copy() instead of dict() 91/19391/1
Shawn O. Pearce [Tue, 7 Dec 2010 16:46:14 +0000 (08:46 -0800)]
Use os.environ.copy() instead of dict()

Signed-off-by: Shawn O. Pearce <sop@google.com>
3 years agoMake path references OS independent 20/19220/1
Anthony Newnam [Mon, 29 Nov 2010 19:15:24 +0000 (13:15 -0600)]
Make path references OS independent

Change-Id: I5573995adfd52fd54bddc62d1d1ea78fb1328130

3 years agoAdded feature to print a <notice> from manifest at the end of a sync. 95/18695/1
Doug Anderson [Mon, 1 Nov 2010 22:08:06 +0000 (15:08 -0700)]
Added feature to print a <notice> from manifest at the end of a sync.

This feature is used to convey information on a when a branch has
ceased development or if it is an experimental branch with a few
gotchas, etc.

You add it to your manifest XML by doing something like this:
<manifest>
  <notice>
    NOTE TO DEVELOPERS:
      If you checkin code, you have to pinky-swear that it contains no bugs.
      Anyone who breaks their promise will have tomatoes thrown at them in the
      team meeting.  Be sure to bring an extra set of clothes.
  </notice>

  <remote ... />
  ...
</manifest>

Carriage returns and indentation are relevant for the text in this tag.

This feature was requested by Anush Elangovan on the ChromiumOS team.

3 years agosync: Use --force-broken to continue other projects 79/16179/2
Andrei Warkentin [Fri, 2 Jul 2010 22:58:31 +0000 (17:58 -0500)]
sync: Use --force-broken to continue other projects

This adds a new flag -f/--force-broken that will allow the rest of
the sync process to continue instead of bailing when a particular
project fails to sync.

Change-Id: I23680f2ee7927410f7ed930b1d469424c9aa246e
Signed-off-by: Andrei Warkentin <andreiw@motorola.com>
Signed-off-by: Shawn O. Pearce <sop@google.com>
3 years agoupload: Remove --replace option 33/18533/2
Ficus Kirkpatrick [Fri, 22 Oct 2010 20:06:47 +0000 (13:06 -0700)]
upload: Remove --replace option

It hasn't been necessary for a long time, and its
functionality can be accomplished with 'git push'.

Change-Id: Ic00d3adbe4cee7be3955117489c69d6e90106559

3 years agosync --quiet: be more quiet 70/18670/2
Shawn O. Pearce [Fri, 29 Oct 2010 19:05:43 +0000 (12:05 -0700)]
sync --quiet: be more quiet

Change-Id: I5e8363c7b32e4546d1236cfc5a32e01c3e5ea8e6
Signed-off-by: Shawn O. Pearce <sop@google.com>
3 years agosync: Enable use of git clone --reference 47/17747/4
Shawn O. Pearce [Fri, 8 Oct 2010 08:02:09 +0000 (10:02 +0200)]
sync: Enable use of git clone --reference

Use git clone to initialize a new repository, and when possible
allow callers to use --reference to reuse an existing checkout as
the initial object storage area for the new checkout.

Change-Id: Ie27f760247f311ce484c6d3e85a90d94da2febfc
Signed-off-by: Shawn O. Pearce <sop@google.com>
3 years agoOnly delete corrupt pickle config files if they exist 68/18668/1
Ulrik Sjölin [Fri, 29 Oct 2010 15:23:30 +0000 (08:23 -0700)]
Only delete corrupt pickle config files if they exist

os.remove() raises OSError if the file being removed doesn't exist.
Check before calling to ensure we don't raise a useless exception
on an already deleted file.

Change-Id: I44c1c7dd97a47fcab8afb6c18fdf179158b6dab7
Signed-off-by: Shawn O. Pearce <sop@google.com>
3 years agoDon't allow git fetch to start ControlMaster 31/18631/2
Doug Anderson [Thu, 28 Oct 2010 00:13:07 +0000 (17:13 -0700)]
Don't allow git fetch to start ControlMaster

To avoid connectivity problems, we don't want the ssh process
that is started by git fetch to become a ControlMaster for the
overall sync task.  If it did, we would lose connectivity when
git fetch was finished with the current project, causing later
projects to not fetch efficiently.

Change-Id: I8d0dcf9b361276ff8c8b5a6324cbd4a501e9c4dd
Signed-off-by: Shawn O. Pearce <sop@google.com>
3 years agoCheck for existing SSH ControlMaster 30/18630/2
Doug Anderson [Thu, 28 Oct 2010 00:06:01 +0000 (17:06 -0700)]
Check for existing SSH ControlMaster

Be more thorough about checking for an existing ssh master by
running a test command first, and only opening up a new master
if the test fails to connect.

Change-Id: I56fe8e7b4dbc123675b7f259e81d359ed0cd55cf
Signed-off-by: Shawn O. Pearce <sop@google.com>
4 years agoFix for handling values of EDITOR which contain a space. 56/16156/4
Patrick Dubroy [Fri, 30 Jul 2010 00:10:47 +0000 (17:10 -0700)]
Fix for handling values of EDITOR which contain a space.

The shell swallows the 0th arg, which was the filename. Simple fix
is to pass in an extra arg for the shell to swallow.

Change-Id: Iad6304ba9ccea6e7262ee06ef87d3dac57dbde81

4 years agoupload: Fix --replace flag 81/15881/1
Shawn O. Pearce [Fri, 16 Jul 2010 14:42:45 +0000 (07:42 -0700)]
upload: Fix --replace flag

--replace started to fail due to a Python error, I forgot to pass
through the opt structure to the replace function.

Change-Id: Ifcd7a0c715c3fd9070a4c58208612a626382de35
Signed-off-by: Shawn O. Pearce <sop@google.com>
4 years agorebase: Pass through more options 70/15870/1
Shawn O. Pearce [Fri, 16 Jul 2010 00:40:41 +0000 (17:40 -0700)]
rebase: Pass through more options

Passing through --whitespace=fix to rebase can be useful
to clean up a branch prior to uploading it for review.

Change-Id: Id85f1912e5e11ff9602e3b342c2fd7441abe67d7
Signed-off-by: Shawn O. Pearce <sop@google.com>
4 years agoupload: Allow review.HOST.username to override email 01/11701/3
Shawn O. Pearce [Fri, 16 Jul 2010 00:00:14 +0000 (17:00 -0700)]
upload: Allow review.HOST.username to override email

Some users might need to use a different login name than the local
part of their email address for their Gerrit Code Review user
account.  Allow it to be overridden with the review.HOST.username
configuration variable.

Change-Id: I714469142ac7feadf09fee9c26680c0e09076b75
Signed-off-by: Shawn O. Pearce <sop@google.com>
4 years agoupload -t: Automatically include local branch name 67/15867/1
Shawn O. Pearce [Thu, 15 Jul 2010 23:52:42 +0000 (16:52 -0700)]
upload -t: Automatically include local branch name

If the -t flag is given to upload, the local branch name is
automatically sent to Gerrit Code Review as the topic branch name
for the change(s).  This requires the server to be Gerrit Code
Review v2.1.3-53-gd50c94e or later, which isn't widely deployed
right now, so the default is opt-out.

Change-Id: I034fcacb405b7cb909147152db427fe69dd7bcbf
Signed-off-by: Shawn O. Pearce <sop@google.com>
4 years agoWarn users before uploading if there are local changes 83/14283/6
Anthony Newnam [Thu, 8 Apr 2010 15:28:59 +0000 (10:28 -0500)]
Warn users before uploading if there are local changes

Change-Id: I231d7b6a3211e9f5ec71a542a0109b0c195d5e40
Signed-off-by: Shawn O. Pearce <sop@google.com>
4 years agosync: Try fetching a tag as a last resort before giving up 47/15347/3
Julius Gustavsson [Thu, 17 Jun 2010 15:55:02 +0000 (17:55 +0200)]
sync: Try fetching a tag as a last resort before giving up

If a tagged commit is not reachable by the fetch refspec configured
for the git (usually refs/heads/*) it will not be downloaded by
'git fetch'.  The tag can however be downloaded with 'git fetch
--tags' or 'git fetch tag <tag>'.

This patch fixes the situation when a tag is not found after a
'git fetch'. Repo will issue 'git fetch tag <tag>' before giving
up completely.

Change-Id: I87796a5e1d51fcf398f346a274b7a069df37599a
Signed-off-by: Shawn O. Pearce <sop@google.com>
4 years agorebase: Automatically rebase branch on upstrea 44/14144/5
Daniel Sandler [Thu, 1 Apr 2010 14:42:33 +0000 (10:42 -0400)]
rebase: Automatically rebase branch on upstrea

  Usage: repo rebase [[-i] <project>...]

Rebases the current topic branch of the specified (or all)
projects against the appropriate upstream.

Note: Interactive rebase is currently only supported when
exactly one project is specified on the command line.

Change-Id: I7376e35f27a6585149def82938c1ca99f36db2c4
Signed-off-by: Shawn O. Pearce <sop@google.com>
4 years agoupload: Automatically --cc folks in review.URL.autocopy 65/15865/2
Ben Komalo [Thu, 15 Jul 2010 23:03:02 +0000 (16:03 -0700)]
upload: Automatically --cc folks in review.URL.autocopy

The upload command will read review.URL.autocopy from the project's
configuration and append the list of e-mails specified to the
--cc argument of the upload command if a non-empty --re argument
was provided.

Change-Id: I2424517d17dd3444b20f0e6a003be6e70b8904f6
Signed-off-by: Shawn O. Pearce <sop@google.com>
4 years agoFix format string bugs in grep 61/15061/3
Sebastian Schmidt [Wed, 2 Jun 2010 15:18:13 +0000 (17:18 +0200)]
Fix format string bugs in grep

This fixes some format string bugs in grep which cause repo to with
"TypeError: not enough arguments for format string" when grepping and
the output contains a valid Python format string.

Change-Id: Ice8968ea106148d409490e4f71a2833b0cc80816

4 years agoDo not invoke ssh with -p argument when no port has been specified. 61/15161/1
Josh Guilfoyle [Sun, 16 Aug 2009 16:44:40 +0000 (09:44 -0700)]
Do not invoke ssh with -p argument when no port has been specified.

This change allows local SSH configuration to choose the port number
to use when not explicitly set in the manifest.

(cherry picked from commit 4c0f67046543c7c6ab24175e143001f14b76ea01)

Change-Id: Ibea99cfe46b6a2cc27f754cc3944a2fe10f6fda4

4 years agoAllow files to be copied into new folders 24/12524/2
Matthew Buckett [Sat, 11 Jul 2009 13:43:47 +0000 (09:43 -0400)]
Allow files to be copied into new folders

Change-Id: I7f169e32be5a4328bb87ce7c2ff4b6529e925126

4 years agoDo not emit progress if stderr is not a tty 33/12233/2
Shawn O. Pearce [Thu, 27 May 2010 23:48:36 +0000 (16:48 -0700)]
Do not emit progress if stderr is not a tty

Avoids logging progress data into cron logs, etc.

Suggested-by: Michael Richardson <mcr@sandelman.ottawa.on.ca>
Change-Id: I4eefa2c282f0ca0a95a0185612b52e2146669e4c
Signed-off-by: Shawn O. Pearce <sop@google.com>
4 years agosync: support --jobs to fetch projects simultaneously 20/14620/4
Roy Lee [Sat, 8 May 2010 20:32:08 +0000 (04:32 +0800)]
sync: support --jobs to fetch projects simultaneously

This patch does two things for being compatibile with
those Python which are built without threading support:

1. As the Python document and Shawn suggested, import dummy_threading
   when the threading is not available.

2. Reserve the single threaded code and make it default.
   In cases the --jobs does not work properly with dummy_threading,
   we still have a safe fallback.

Change-Id: I40909ef8e9b5c22f315c0a1da9be38eed8b0a2dc

4 years agoAliasing sync -s to 'smartsync' 65/14665/3
Nico Sallembien [Tue, 11 May 2010 19:57:01 +0000 (12:57 -0700)]
Aliasing sync -s to 'smartsync'

This alias will let people use this command without having to
remember the option.

Change-Id: I3256d9e8e884c5be9e77f70e9cfb73e0f0c544c6

4 years agosync: kill git fetch process before SSH control master process 78/14678/3
Shawn O. Pearce [Wed, 12 May 2010 01:21:33 +0000 (18:21 -0700)]
sync: kill git fetch process before SSH control master process

If the SSH control master process is killed while an active git
fetch is using its network socket, the underlying SSH client may
not realize the connection was broken.  This can lead to both the
client and the server waiting indefinitely for network messages
which will never be sent.

Work around the problem by keeping track of any processes that use
the tunnels we establish.  If we are about to kill any of the SSH
control masters that we started, ensure the clients using them are
successfully killed first.

Change-Id: Ida6c124dcb0c6a26bf7dd69cba2fbdc2ecd5b2fc
Signed-off-by: Shawn O. Pearce <sop@google.com>
4 years agoupload: Move confirmation threshold from 3 to 5 commits 74/14574/2
Dan Morrill [Wed, 5 May 2010 15:18:35 +0000 (08:18 -0700)]
upload: Move confirmation threshold from 3 to 5 commits

Change-Id: I7275d195cf04f02694206b9f838540b0228ff5e1

4 years agoupload: Confirm unusually large number of uploaded commit 65/14565/3
Dan Morrill [Tue, 4 May 2010 23:56:07 +0000 (16:56 -0700)]
upload: Confirm unusually large number of uploaded commit

Add a sentinel check to require a second explicit confirmation if the
user is attempting to upload (or upload --replace) an unusually large
number of commits.  This may help the user to catch an accidentally
incorrect rebase they had done previously.

Change-Id: I12c4d102f90a631d6ad193486a70ffd520ef6ae0

4 years agobranches: Enable output of multiple projects 67/11667/3
Pär Åsfält [Sat, 5 Sep 2009 21:10:56 +0000 (23:10 +0200)]
branches: Enable output of multiple projects

Fixes a bug introduced by 498a0e8a79ab76eeb6adc40f12b04d59820716f9
("Make 'repo branches -a' the default behavior").

Change-Id: Ib739f82f4647890c46d7c9fb2f2e63a16a0481de

4 years agoRename _ssh_sock() to fix code style issue. 50/14450/1
Nico Sallembien [Tue, 27 Apr 2010 21:35:27 +0000 (14:35 -0700)]
Rename _ssh_sock() to fix code style issue.

Since _ssh_sock is imported out of the git_command module, the leading
underscore should be removed from the function name.

4 years agoOverride manifest file only after it is fully written to disk. 44/14344/3
Nico Sallembien [Tue, 20 Apr 2010 22:28:19 +0000 (15:28 -0700)]
Override manifest file only after it is fully written to disk.

We called "Override()" before closing the file passed in argument.

Change-Id: I15adb99deb14297ef72fcb1b0945eb246f172fb0

4 years agoStrip refs/heads in the branch sent to the manifest server. 43/14343/2
Nico Sallembien [Mon, 26 Apr 2010 18:17:29 +0000 (11:17 -0700)]
Strip refs/heads in the branch sent to the manifest server.

The manifest server doesn't want to have refs/heads passed to it, so
we need to strip that when the branch contains it.

Change-Id: I044f8a9629220e886fd5e02e3c1ac4b4bb6020ba

4 years agosync: Safely skip already deleted projects 60/11960/2
Anthony [Sat, 26 Sep 2009 17:38:52 +0000 (13:38 -0400)]
sync: Safely skip already deleted projects

Do not error if a project is missing on the filesystem, is deleted
from manifest.xml, but still exists in project.list.

Change-Id: I1d13e435473c83091e27e4df571504ef493282dd

4 years agoAdd a 'smart sync' option to repo sync 84/14184/5
Nico Sallembien [Tue, 6 Apr 2010 17:40:01 +0000 (10:40 -0700)]
Add a 'smart sync' option to repo sync

This option allows the user to specify a manifest server to use when
syncing. This manifest server will provide a manifest pegging each
project to a known green build. This allows developers to work on a
known good tree that is known to build and pass tests, preventing
failed builds to hamper productivity.

The manifest used is not "sticky" so as to allow subsequent
'repo sync' calls to sync to the tip of the tree.

Change-Id: Id0a24ece20f5a88034ad364b416a1dd2e394226d

4 years agoAllow 'y' as a valid response when confirming identity 48/14148/1
Nico Sallembien [Thu, 1 Apr 2010 18:03:53 +0000 (11:03 -0700)]
Allow 'y' as a valid response when confirming identity

I prefer having to type only one character rather than all three,
and it seems like other confirmation prompts use the same style.

4 years agoMerge branch 'stable' 97/13897/1
Shawn O. Pearce [Sun, 7 Mar 2010 03:29:56 +0000 (19:29 -0800)]
Merge branch 'stable'

* stable:
  Automatically install Gerrit Code Review's commit-msg hook
  Fail sync when encountering "N commits behind."
  Check that we are not overwriting a local repository when syncing.
  Honor url.insteadOf when setting up SSH control master connection
  sync: Fix split call on malformed email addresses
  Fixing project renaming bug.

Conflicts:
hooks/commit-msg
project.py
subcmds/sync.py

Change-Id: I5eaf8fef8cbe4a95d124368112293a9ca64325bf

4 years agoAutomatically install Gerrit Code Review's commit-msg hook 64/13764/2
Shawn O. Pearce [Sun, 23 Aug 2009 01:17:46 +0000 (18:17 -0700)]
Automatically install Gerrit Code Review's commit-msg hook

Most users of repo are also using Gerrit Code Review, and will want
the commit-msg hook to be automatically installed into their local
projects so that Change-Ids are assigned when commits are created,
not when they are first uploaded.

(cherry picked from commit a949fa5d202f0a1f812d7630f3e5bf0f02ca4e98
 but squashed with latest hook script from version 2.1.2)

Change-Id: Ie68b2d60ac85d8c2285d2e1e6a4536eb76695547
Signed-off-by: Shawn O. Pearce <sop@google.com>
4 years agoFail sync when encountering "N commits behind." 56/13856/1
Daniel Sandler [Tue, 2 Mar 2010 20:38:03 +0000 (15:38 -0500)]
Fail sync when encountering "N commits behind."

This is almost always something the user needs to address
before continuing work, so promoting it to a failure (rather
than simply an informational message) seems the right way to
go. As a side-effect, repo will now exit with a non-zero
status code in this situation, so pipelines of the form
`repo sync && make` will fail if there are branches that
are stalled due to uploaded but unmerged patches.

4 years agoCheck that we are not overwriting a local repository when syncing. 53/13253/1
Nico Sallembien [Wed, 20 Jan 2010 18:27:50 +0000 (10:27 -0800)]
Check that we are not overwriting a local repository when syncing.

If a local git repository exists within the same folder as a new project that
is added, when the user syncs the repo, the sync will overwrite the local
files under the project's .git repository with its own symlinks. Make sure
that we do not overwrite 'normal' files in repo and throw an error when
that happens.

4 years agoHonor url.insteadOf when setting up SSH control master connection 20/13120/3
Ulrik Sjolin [Sun, 3 Jan 2010 17:20:17 +0000 (18:20 +0100)]
Honor url.insteadOf when setting up SSH control master connection

Repo can now properly handle url.insteadOf sections in the
user's ~/.gitconfig file.  This means that a user can now enjoy
the master-ssh functionality even if he/she uses insteadOf's in
~/.gitconfig to rewrite git:// URLs to ssh:// style URLs.

Change-Id: Ic0f04a9c57206a7b89eb0f10bf188c4c483debe3
Signed-off-by: Shawn O. Pearce <sop@google.com>
4 years agosync: Fix split call on malformed email addresses 05/13105/1
Shawn O. Pearce [Thu, 31 Dec 2009 02:38:27 +0000 (18:38 -0800)]
sync: Fix split call on malformed email addresses

If an email address in a commit object contains a space, like a few
malformed ones on the Linux kernel, we still want to split only on
the first space.

Unfortunately my brain was too damaged by Perl and originally wrote
the split asking for 2 results; in Python split's argument is how
many splits to perform.  Here we want only 1 split, to break apart
the commit identity from the email address on the same line.

Signed-off-by: Shawn O. Pearce <sop@google.com>
4 years agoFixing project renaming bug. 46/12846/1
Nico Sallembien [Mon, 7 Dec 2009 23:38:01 +0000 (15:38 -0800)]
Fixing project renaming bug.

This bug happens when a project gets added to the manifest, and
then is renamed. Users who happened to have run "repo sync" after
the project was added but before the rename happened will try to
read the data from the old project, as the manifest was only updated
after all projects were updated successfully.

5 years agoFix to display the usage message of the command download when the user 85/11685/1
Thiago Farina [Wed, 9 Sep 2009 04:41:34 +0000 (00:41 -0400)]
Fix to display the usage message of the command download when the user
don't provide any arguments to 'repo download'.

Signed-off-by: Thiago Farina <thiago.farina@gmail.com>
5 years agocommit-msg: Don't create message with only Change-Id 65/11365/1
Shawn O. Pearce [Tue, 25 Aug 2009 18:38:11 +0000 (11:38 -0700)]
commit-msg: Don't create message with only Change-Id

If a user aborts a commit, the commit-msg hook is still called,
but with an empty file.  We need to leave the empty file alone.

Change-Id: I13766135dac267823cb08ab76f67d2000ba2d1ce
Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agocommit-msg: Update the commit message hook 40/11340/1
Shawn O. Pearce [Sun, 23 Aug 2009 02:23:55 +0000 (19:23 -0700)]
commit-msg: Update the commit message hook

This version fixes a bug where Change-Id lines become the subject
line, if the subject used a pattern like the subject of this
message does.

Change-Id: I7f7e0363091d03eb05dead2992fc19763214de65
Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agoforall: Silently skip missing projects 35/11335/1
Shawn O. Pearce [Sun, 23 Aug 2009 01:50:45 +0000 (18:50 -0700)]
forall: Silently skip missing projects

If a project is missing locally, it might be OK to skip over it
and continue running the same command in other projects.

Bug: REPO-43
Change-Id: I64f97eb315f379ab2c51fc53d24ed340b3d09250
Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agoupload: Catch and cleanly report connectivity errors 34/11334/1
Shawn O. Pearce [Sun, 23 Aug 2009 01:39:49 +0000 (18:39 -0700)]
upload: Catch and cleanly report connectivity errors

Instead of giving a Python backtrace when there is a connectivity
problem during repo upload, report that we cannot access the host,
and why, with a halfway decent error message.

Bug: REPO-45
Change-Id: I9a45b387e86e48073a2d99bd6d594c1a7d6d99d4
Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agoupload: Document --replace is deprecated 33/11333/1
Shawn O. Pearce [Sun, 23 Aug 2009 01:24:13 +0000 (18:24 -0700)]
upload: Document --replace is deprecated

Change-Id: I52715bcfec9c038d0e02505aa7e4054ebc0434aa
Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agoAutomatically install Gerrit Code Review's commit-msg hook 32/11332/1
Shawn O. Pearce [Sun, 23 Aug 2009 01:17:46 +0000 (18:17 -0700)]
Automatically install Gerrit Code Review's commit-msg hook

Most users of repo are also using Gerrit Code Review, and will want
the commit-msg hook to be automatically installed into their local
projects so that Change-Ids are assigned when commits are created,
not when they are first uploaded.

Change-Id: Ide42e93b068832f099d68a79c2863d22145d05ad
Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agoMerge change 11206 14/11214/1
Shawn O. Pearce [Mon, 17 Aug 2009 15:09:02 +0000 (08:09 -0700)]
Merge change 11206

* change 11206:
  Do not invoke ssh with -p argument when no port has been specified.

5 years agoDo not invoke ssh with -p argument when no port has been specified. 06/11206/1
Josh Guilfoyle [Sun, 16 Aug 2009 16:44:40 +0000 (09:44 -0700)]
Do not invoke ssh with -p argument when no port has been specified.

This change allows local SSH configuration to choose the port number to
use when not explicitly set in the manifest.

5 years agoAdd "repo branch" as an alias for "repo branches" 69/10669/1
Mike Lockwood [Tue, 14 Jul 2009 19:23:39 +0000 (15:23 -0400)]
Add "repo branch" as an alias for "repo branches"

For those of us that are used to typing "git branch".

Signed-off-by: Mike Lockwood <lockwood@android.com>
5 years agomanifest: Support --upgrade to submodule format, from XML 11/10611/1
Shawn O. Pearce [Sat, 4 Jul 2009 01:06:22 +0000 (18:06 -0700)]
manifest: Support --upgrade to submodule format, from XML

By running `repo manifest --uprade` an administrator can update the
current manifest format from the XML format to submodule format, but
we need all projects to be checked out in a work tree for this to
function correctly.

Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agoIntroduce manifest format using git submodules 10/10610/1
Shawn O. Pearce [Sat, 4 Jul 2009 01:05:23 +0000 (18:05 -0700)]
Introduce manifest format using git submodules

If a manifest top level directory contains '.gitmodules' we now
assume this is a git module format manifest and switch to using
that code, rather than the legacy XML based manifest.

At the same time, we move the bare repository for a project from
$TOP/.repo/projects/$REPO_PATH.git to be $REPO_NAME.git instead.
This makes it easier for us to later support a repo init from an
existing work tree, as we can more accurately predict the path of
the project's repository in the workspace.  It also means that the
$TOP/.repo/projects/ directory is layed out like a mirror would be.

Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agoAllow meta projects to be created not under .repo/ 09/10609/1
Shawn O. Pearce [Sat, 4 Jul 2009 01:04:27 +0000 (18:04 -0700)]
Allow meta projects to be created not under .repo/

Some types of manifests might prefer to put their meta project work
tree under topdir, rather than inside of the .repo/ directory.  We
can support that by allowing relpath to be optionally passed in.

Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agosync: Support upgrading manifest formats 08/10608/1
Shawn O. Pearce [Fri, 3 Jul 2009 23:37:30 +0000 (16:37 -0700)]
sync: Support upgrading manifest formats

If the manifest format changes during init or sync we need to do
a full reparse of the manifest, and possibly allow the new object
to reconfigure the local workspace to match its expectations.

Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agoinit: add -o, --origin to name manifest remote 07/10607/1
Shawn O. Pearce [Sat, 4 Jul 2009 00:24:17 +0000 (17:24 -0700)]
init: add -o, --origin to name manifest remote

The -o option permits the user to control the name of the manifest's
remote, which normally is hardcoded to be 'origin', but can differ
because we derive it at runtime from the configuration file.

Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agoinit (wrapper): Note that -m is now deprecated 06/10606/1
Shawn O. Pearce [Sat, 4 Jul 2009 00:24:45 +0000 (17:24 -0700)]
init (wrapper): Note that -m is now deprecated

If the manifest format isn't XML, this option isn't available.

Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agoinit: Ensure repo.mirror is noticed once set 05/10605/1
Shawn O. Pearce [Sat, 4 Jul 2009 03:06:13 +0000 (20:06 -0700)]
init: Ensure repo.mirror is noticed once set

If we don't clear the cache, there can be a timestamp race between
the pickle file and the raw text file, and we may not pick up the
edit when we create a new config object around the same path name.

Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agoAllow the manifest to be accessed it if is in work tree 04/10604/1
Shawn O. Pearce [Fri, 3 Jul 2009 23:52:28 +0000 (16:52 -0700)]
Allow the manifest to be accessed it if is in work tree

If the manifest's work tree is actually inside of the rest of
the client work tree then its only fair that we include it as
a project that the user can access.

Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agoAbstract manifest branch creation from init to the manifest object 03/10603/1
Shawn O. Pearce [Fri, 3 Jul 2009 23:24:57 +0000 (16:24 -0700)]
Abstract manifest branch creation from init to the manifest object

This permits the XML style manifest to use 'default', while other
types can use their own creation strategy for the current branch.

Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agoAllow callers to request a specific type of manifest 02/10602/1
Shawn O. Pearce [Fri, 3 Jul 2009 23:16:18 +0000 (16:16 -0700)]
Allow callers to request a specific type of manifest

If the caller knows exactly what the manifest type must be we
can now ask the loader to directly construct that type, rather
than guessing it from the working directory.

Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agoMake refs/remotes/m management the manifest object's responsibility 01/10601/1
Shawn O. Pearce [Fri, 3 Jul 2009 22:29:02 +0000 (15:29 -0700)]
Make refs/remotes/m management the manifest object's responsibility

I plan to have the new submodule manifest format use a different
layout for the m refs than the XML manifest format has used in
the past.  Thus we need to move the behavior management into the
manifest object, and out of the project, so we can change it.

Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agoCleanup import formatting in manifest_xml.py 00/10600/1
Shawn O. Pearce [Fri, 3 Jul 2009 22:26:17 +0000 (15:26 -0700)]
Cleanup import formatting in manifest_xml.py

Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agoOnly remove a stale pickle file if it exists 99/10599/1
Shawn O. Pearce [Sat, 4 Jul 2009 03:01:47 +0000 (20:01 -0700)]
Only remove a stale pickle file if it exists

Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agosync: Run `git gc --auto` after fetch 98/10598/1
Shawn O. Pearce [Fri, 3 Jul 2009 22:22:49 +0000 (15:22 -0700)]
sync: Run `git gc --auto` after fetch

Users may wind up with a lot of loose object content in projects they
don't frequently make changes in, but that are modified by others.

Since we bypass many git code paths that would have otherwise called
out to `git gc --auto`, its possible for these projects to have
their loose object database grow out of control.  To help prevent
that, we now invoke it ourselves during the network half of sync.

Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agoinit: Allow -m only on XML formatted manifest 96/10596/1
Shawn O. Pearce [Wed, 20 May 2009 01:14:04 +0000 (18:14 -0700)]
init: Allow -m only on XML formatted manifest

If the manifest is the newer SubmoduleManifest style, then the -m
option makes no sense, as you cannot select a specific file within
the current branch.

Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agomanifest: Only support -o option on XML formatted manifest 95/10595/1
Shawn O. Pearce [Wed, 20 May 2009 01:17:51 +0000 (18:17 -0700)]
manifest: Only support -o option on XML formatted manifest

If the manifest isn't a single file format manifest, the -o option
makes no sense, as you cannot export multiple files to a single
stream for display or redirection.

Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agomanifest: Only display XML help on XML manifest 94/10594/1
Shawn O. Pearce [Wed, 3 Jun 2009 21:16:14 +0000 (14:16 -0700)]
manifest: Only display XML help on XML manifest

Some of the help text is only related to the XML formatted manifest,
so only display that text if that is the current format.

Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agohelp: Don't show empty Summary or Description sections 93/10593/1
Shawn O. Pearce [Thu, 4 Jun 2009 00:43:16 +0000 (17:43 -0700)]
help: Don't show empty Summary or Description sections

Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agoCreate an abstract Manifest base class 92/10592/1
Shawn O. Pearce [Wed, 3 Jun 2009 23:01:11 +0000 (16:01 -0700)]
Create an abstract Manifest base class

This will help as we add support for another manifest type.

Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agoTeach Project how to relink a .git/ in the work tree 91/10591/1
Shawn O. Pearce [Fri, 5 Jun 2009 02:49:36 +0000 (19:49 -0700)]
Teach Project how to relink a .git/ in the work tree

The _LinkWorkTree method can now be used to relink the work tree,
such as if the real repository was moved to a different location
on disk.

Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agoAllow callers to reset the git config cache 90/10590/1
Shawn O. Pearce [Fri, 5 Jun 2009 02:19:11 +0000 (19:19 -0700)]
Allow callers to reset the git config cache

If commands modify the git config too rapidly we might not notice
the .git/config file has been modified, as they could run in the
same filesystem timestamp window and thus not cause a change on
the config's mtime.  This can cause repo to miss re-reading the
config file after running a command.

Allowing the cache to be flushed forces us to re-read the config.

Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agoFix error parsing a non-existant configuration file 84/10584/1
Shawn O. Pearce [Thu, 2 Jul 2009 23:12:57 +0000 (16:12 -0700)]
Fix error parsing a non-existant configuration file

If a file (e.g. ~/.gitconfig) does not exist, we get None
here rather than a string.  NoneType lacks rstrip() so we
cannot strip it.

Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agoDocument how to contribute to the repo project 82/10582/1
Shawn O. Pearce [Thu, 2 Jul 2009 20:18:42 +0000 (13:18 -0700)]
Document how to contribute to the repo project

Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agoSupport GIT_EDITOR='vim -c "set textwidth=80"' 80/10580/1
Shawn O. Pearce [Thu, 2 Jul 2009 19:45:47 +0000 (12:45 -0700)]
Support GIT_EDITOR='vim -c "set textwidth=80"'

If there are shell special characters in the editor string, we must
use /bin/sh to parse and execute it, rather than trying to rely on
a simple split(' ').  This avoids vim starting up with two empty
buffers, due to a misparsed command line.

Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agoTry to prevent 'repo sync' as a user name 78/10578/1
Shawn O. Pearce [Thu, 2 Jul 2009 17:53:04 +0000 (10:53 -0700)]
Try to prevent 'repo sync' as a user name

When someone copies and pastes a setup line from a web page,
they might actually copy 'repo sync' onto the clipboard and wind
up pasting it into the "Your Name" prompt.  This means they will
initialize their client with the user name of "repo sync", creating
some rather funny looking commits later on.  For example:

  To setup your source tree:

    mkdir ~/code
    cd ~/code
    repo init -u git://....
    repo sync

If this entire block was just blindly copy and pasted into the
terminal, the shell won't read "repo sync" but "repo init" will.

By showing the user their full identity string, and asking them
to confirm it before we continue, we can give the hapless user a
chance to recover from this mistake, without unfairly harming those
who were actually named 'repo' by their parents.

Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agogit_config: handle configuration entries with no values 18/10518/1
David Aguilar [Sun, 28 Jun 2009 22:09:16 +0000 (15:09 -0700)]
git_config: handle configuration entries with no values

A git-config entry with no value was preventing repo
from initializing.  This modifies _ReadGit() to handle
config entries with empty values.

Signed-off-by: David Aguilar <davvid@gmail.com>
Reported-by: Josh Guilfoyle <jasta00@gmail.com>
5 years ago.gitignore: add an entry for repopickles 16/10516/1
David Aguilar [Sun, 28 Jun 2009 22:08:56 +0000 (15:08 -0700)]
.gitignore: add an entry for repopickles

Signed-off-by: David Aguilar <davvid@gmail.com>
5 years agoSupport detached HEAD in manifest repository 11/10511/1
Shawn O. Pearce [Thu, 25 Jun 2009 23:47:30 +0000 (16:47 -0700)]
Support detached HEAD in manifest repository

If the manifest repository is on a detached HEAD and we are parsing
an XML formatted manifest we should simply set the branch property
to None, rather than crash with an AttributeError.

Signed-off-by: Shawn O. Pearce <sop@google.com>
5 years agoDocument any crashes from the user's text editor 96/10496/1
Shawn O. Pearce [Wed, 24 Jun 2009 14:09:51 +0000 (07:09 -0700)]
Document any crashes from the user's text editor

Rather than failing with no information, display the child exit
status and the command line we tried to use to edit a text file.
There may be some useful information to help understand the crash.

Signed-off-by: Shawn O. Pearce <sop@google.com>