From 09b8dafa5ed8866039b5f57e18969eab800e6518 Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter_e@gmx.net>
Date: Tue, 10 Mar 2015 22:33:25 -0400
Subject: [PATCH 7/7] Move pg_upgrade from contrib/ to src/bin/

---
 contrib/Makefile                               |  1 -
 doc/src/sgml/contrib.sgml                      |  1 -
 doc/src/sgml/filelist.sgml                     |  1 -
 doc/src/sgml/ref/allfiles.sgml                 |  1 +
 doc/src/sgml/{ => ref}/pgupgrade.sgml          | 14 +++-----------
 doc/src/sgml/reference.sgml                    |  1 +
 src/bin/Makefile                               |  1 +
 {contrib => src/bin}/pg_upgrade/.gitignore     |  0
 {contrib => src/bin}/pg_upgrade/IMPLEMENTATION |  2 --
 {contrib => src/bin}/pg_upgrade/Makefile       | 18 +++++++-----------
 {contrib => src/bin}/pg_upgrade/TESTING        |  2 --
 {contrib => src/bin}/pg_upgrade/check.c        |  2 +-
 {contrib => src/bin}/pg_upgrade/controldata.c  |  2 +-
 {contrib => src/bin}/pg_upgrade/dump.c         |  2 +-
 {contrib => src/bin}/pg_upgrade/exec.c         |  2 +-
 {contrib => src/bin}/pg_upgrade/file.c         |  2 +-
 {contrib => src/bin}/pg_upgrade/function.c     |  2 +-
 {contrib => src/bin}/pg_upgrade/info.c         |  2 +-
 {contrib => src/bin}/pg_upgrade/option.c       |  2 +-
 {contrib => src/bin}/pg_upgrade/page.c         |  2 +-
 {contrib => src/bin}/pg_upgrade/parallel.c     |  2 +-
 {contrib => src/bin}/pg_upgrade/pg_upgrade.c   |  2 +-
 {contrib => src/bin}/pg_upgrade/pg_upgrade.h   |  2 +-
 {contrib => src/bin}/pg_upgrade/relfilenode.c  |  2 +-
 {contrib => src/bin}/pg_upgrade/server.c       |  2 +-
 {contrib => src/bin}/pg_upgrade/tablespace.c   |  2 +-
 {contrib => src/bin}/pg_upgrade/test.sh        |  8 ++++----
 {contrib => src/bin}/pg_upgrade/util.c         |  2 +-
 {contrib => src/bin}/pg_upgrade/version.c      |  2 +-
 src/tools/msvc/vcregress.pl                    |  6 +++---
 30 files changed, 37 insertions(+), 53 deletions(-)
 rename doc/src/sgml/{ => ref}/pgupgrade.sgml (98%)
 rename {contrib => src/bin}/pg_upgrade/.gitignore (100%)
 rename {contrib => src/bin}/pg_upgrade/IMPLEMENTATION (99%)
 rename {contrib => src/bin}/pg_upgrade/Makefile (79%)
 rename {contrib => src/bin}/pg_upgrade/TESTING (99%)
 rename {contrib => src/bin}/pg_upgrade/check.c (99%)
 rename {contrib => src/bin}/pg_upgrade/controldata.c (99%)
 rename {contrib => src/bin}/pg_upgrade/dump.c (99%)
 rename {contrib => src/bin}/pg_upgrade/exec.c (99%)
 rename {contrib => src/bin}/pg_upgrade/file.c (99%)
 rename {contrib => src/bin}/pg_upgrade/function.c (99%)
 rename {contrib => src/bin}/pg_upgrade/info.c (99%)
 rename {contrib => src/bin}/pg_upgrade/option.c (99%)
 rename {contrib => src/bin}/pg_upgrade/page.c (99%)
 rename {contrib => src/bin}/pg_upgrade/parallel.c (99%)
 rename {contrib => src/bin}/pg_upgrade/pg_upgrade.c (99%)
 rename {contrib => src/bin}/pg_upgrade/pg_upgrade.h (99%)
 rename {contrib => src/bin}/pg_upgrade/relfilenode.c (99%)
 rename {contrib => src/bin}/pg_upgrade/server.c (99%)
 rename {contrib => src/bin}/pg_upgrade/tablespace.c (98%)
 rename {contrib => src/bin}/pg_upgrade/test.sh (97%)
 rename {contrib => src/bin}/pg_upgrade/util.c (99%)
 rename {contrib => src/bin}/pg_upgrade/version.c (99%)

diff --git a/contrib/Makefile b/contrib/Makefile
index 39e8f1d..e2c4e27 100644
--- a/contrib/Makefile
+++ b/contrib/Makefile
@@ -34,7 +34,6 @@ SUBDIRS = \
 		pg_standby	\
 		pg_stat_statements \
 		pg_trgm		\
-		pg_upgrade	\
 		pgcrypto	\
 		pgrowlocks	\
 		pgstattuple	\
diff --git a/doc/src/sgml/contrib.sgml b/doc/src/sgml/contrib.sgml
index 885a096..49a6ce8 100644
--- a/doc/src/sgml/contrib.sgml
+++ b/doc/src/sgml/contrib.sgml
@@ -202,6 +202,5 @@ <title>Server Applications</title>
   </para>
 
  &pgstandby;
- &pgupgrade;
  </sect1>
 </appendix>
diff --git a/doc/src/sgml/filelist.sgml b/doc/src/sgml/filelist.sgml
index d6120e3..a240d7e 100644
--- a/doc/src/sgml/filelist.sgml
+++ b/doc/src/sgml/filelist.sgml
@@ -133,7 +133,6 @@
 <!ENTITY pgstatstatements SYSTEM "pgstatstatements.sgml">
 <!ENTITY pgstattuple     SYSTEM "pgstattuple.sgml">
 <!ENTITY pgtrgm          SYSTEM "pgtrgm.sgml">
-<!ENTITY pgupgrade       SYSTEM "pgupgrade.sgml">
 <!ENTITY postgres-fdw    SYSTEM "postgres-fdw.sgml">
 <!ENTITY seg             SYSTEM "seg.sgml">
 <!ENTITY contrib-spi     SYSTEM "contrib-spi.sgml">
diff --git a/doc/src/sgml/ref/allfiles.sgml b/doc/src/sgml/ref/allfiles.sgml
index 39e0244..0a35b4c 100644
--- a/doc/src/sgml/ref/allfiles.sgml
+++ b/doc/src/sgml/ref/allfiles.sgml
@@ -194,6 +194,7 @@
 <!ENTITY pgRestore          SYSTEM "pg_restore.sgml">
 <!ENTITY pgtestfsync        SYSTEM "pgtestfsync.sgml">
 <!ENTITY pgtesttiming       SYSTEM "pgtesttiming.sgml">
+<!ENTITY pgupgrade          SYSTEM "pgupgrade.sgml">
 <!ENTITY pgxlogdump         SYSTEM "pg_xlogdump.sgml">
 <!ENTITY postgres           SYSTEM "postgres-ref.sgml">
 <!ENTITY postmaster         SYSTEM "postmaster.sgml">
diff --git a/doc/src/sgml/pgupgrade.sgml b/doc/src/sgml/ref/pgupgrade.sgml
similarity index 98%
rename from doc/src/sgml/pgupgrade.sgml
rename to doc/src/sgml/ref/pgupgrade.sgml
index 8d70727..8b3912d 100644
--- a/doc/src/sgml/pgupgrade.sgml
+++ b/doc/src/sgml/ref/pgupgrade.sgml
@@ -1,4 +1,4 @@
-<!-- doc/src/sgml/pgupgrade.sgml -->
+<!-- doc/src/sgml/ref/pgupgrade.sgml -->
 
 <refentry id="pgupgrade">
  <indexterm zone="pgupgrade">
@@ -240,7 +240,8 @@ <title>For source installs, build the new version</title>
     <title>Install the new PostgreSQL binaries</title>
 
     <para>
-     Install the new server's binaries and support files.
+     Install the new server's binaries and support
+     files.  <application>pg_upgrade</> is included in a default installation.
     </para>
 
     <para>
@@ -253,15 +254,6 @@ <title>Install the new PostgreSQL binaries</title>
    </step>
 
    <step>
-    <title>Install pg_upgrade</title>
-
-    <para>
-     Install the <application>pg_upgrade</> binary in the new PostgreSQL
-     installation.
-    </para>
-   </step>
-
-   <step>
     <title>Initialize the new PostgreSQL cluster</title>
 
     <para>
diff --git a/doc/src/sgml/reference.sgml b/doc/src/sgml/reference.sgml
index 99bfcda..e1484f4 100644
--- a/doc/src/sgml/reference.sgml
+++ b/doc/src/sgml/reference.sgml
@@ -264,6 +264,7 @@ <title>PostgreSQL Server Applications</title>
    &pgResetxlog;
    &pgtestfsync;
    &pgtesttiming;
+   &pgupgrade;
    &pgxlogdump;
    &postgres;
    &postmaster;
diff --git a/src/bin/Makefile b/src/bin/Makefile
index 253119a..47ef00c 100644
--- a/src/bin/Makefile
+++ b/src/bin/Makefile
@@ -24,6 +24,7 @@ SUBDIRS = \
 	pg_resetxlog \
 	pg_test_fsync \
 	pg_test_timing \
+	pg_upgrade \
 	pg_xlogdump \
 	pgbench \
 	psql \
diff --git a/contrib/pg_upgrade/.gitignore b/src/bin/pg_upgrade/.gitignore
similarity index 100%
rename from contrib/pg_upgrade/.gitignore
rename to src/bin/pg_upgrade/.gitignore
diff --git a/contrib/pg_upgrade/IMPLEMENTATION b/src/bin/pg_upgrade/IMPLEMENTATION
similarity index 99%
rename from contrib/pg_upgrade/IMPLEMENTATION
rename to src/bin/pg_upgrade/IMPLEMENTATION
index a0cfcf1..9b5ff72 100644
--- a/contrib/pg_upgrade/IMPLEMENTATION
+++ b/src/bin/pg_upgrade/IMPLEMENTATION
@@ -1,5 +1,3 @@
-contrib/pg_upgrade/IMPLEMENTATION
-
 ------------------------------------------------------------------------------
 PG_UPGRADE: IN-PLACE UPGRADES FOR POSTGRESQL
 ------------------------------------------------------------------------------
diff --git a/contrib/pg_upgrade/Makefile b/src/bin/pg_upgrade/Makefile
similarity index 79%
rename from contrib/pg_upgrade/Makefile
rename to src/bin/pg_upgrade/Makefile
index 87da4b8..c22daa5 100644
--- a/contrib/pg_upgrade/Makefile
+++ b/src/bin/pg_upgrade/Makefile
@@ -1,8 +1,12 @@
-# contrib/pg_upgrade/Makefile
+# src/bin/pg_upgrade/Makefile
 
 PGFILEDESC = "pg_upgrade - an in-place binary upgrade utility"
 PGAPPICON = win32
 
+subdir = src/bin/pg_upgrade
+top_builddir = ../../..
+include $(top_builddir)/src/Makefile.global
+
 PROGRAM  = pg_upgrade
 OBJS = check.o controldata.o dump.o exec.o file.o function.o info.o \
        option.o page.o parallel.o pg_upgrade.o relfilenode.o server.o \
@@ -15,16 +19,8 @@ EXTRA_CLEAN = analyze_new_cluster.sh delete_old_cluster.sh log/ tmp_check/ \
               pg_upgrade_dump_globals.sql \
               pg_upgrade_dump_*.custom pg_upgrade_*.log
 
-ifdef USE_PGXS
-PG_CONFIG = pg_config
-PGXS := $(shell $(PG_CONFIG) --pgxs)
-include $(PGXS)
-else
-subdir = contrib/pg_upgrade
-top_builddir = ../..
-include $(top_builddir)/src/Makefile.global
-include $(top_srcdir)/contrib/contrib-global.mk
-endif
+NO_PGXS = 1
+include $(top_srcdir)/src/makefiles/pgxs.mk
 
 check: test.sh all
 	MAKE=$(MAKE) bindir=$(bindir) libdir=$(libdir) EXTRA_REGRESS_OPTS="$(EXTRA_REGRESS_OPTS)" $(SHELL) $< --install
diff --git a/contrib/pg_upgrade/TESTING b/src/bin/pg_upgrade/TESTING
similarity index 99%
rename from contrib/pg_upgrade/TESTING
rename to src/bin/pg_upgrade/TESTING
index 359688c..4ecfc57 100644
--- a/contrib/pg_upgrade/TESTING
+++ b/src/bin/pg_upgrade/TESTING
@@ -1,5 +1,3 @@
-contrib/pg_upgrade/TESTING
-
 The most effective way to test pg_upgrade, aside from testing on user
 data, is by upgrading the PostgreSQL regression database.
 
diff --git a/contrib/pg_upgrade/check.c b/src/bin/pg_upgrade/check.c
similarity index 99%
rename from contrib/pg_upgrade/check.c
rename to src/bin/pg_upgrade/check.c
index 6a498c3..647bf34 100644
--- a/contrib/pg_upgrade/check.c
+++ b/src/bin/pg_upgrade/check.c
@@ -4,7 +4,7 @@
  *	server checks and output routines
  *
  *	Copyright (c) 2010-2015, PostgreSQL Global Development Group
- *	contrib/pg_upgrade/check.c
+ *	src/bin/pg_upgrade/check.c
  */
 
 #include "postgres_fe.h"
diff --git a/contrib/pg_upgrade/controldata.c b/src/bin/pg_upgrade/controldata.c
similarity index 99%
rename from contrib/pg_upgrade/controldata.c
rename to src/bin/pg_upgrade/controldata.c
index 0e70b6f..bf53db0 100644
--- a/contrib/pg_upgrade/controldata.c
+++ b/src/bin/pg_upgrade/controldata.c
@@ -4,7 +4,7 @@
  *	controldata functions
  *
  *	Copyright (c) 2010-2015, PostgreSQL Global Development Group
- *	contrib/pg_upgrade/controldata.c
+ *	src/bin/pg_upgrade/controldata.c
  */
 
 #include "postgres_fe.h"
diff --git a/contrib/pg_upgrade/dump.c b/src/bin/pg_upgrade/dump.c
similarity index 99%
rename from contrib/pg_upgrade/dump.c
rename to src/bin/pg_upgrade/dump.c
index 906e85f..2c20e84 100644
--- a/contrib/pg_upgrade/dump.c
+++ b/src/bin/pg_upgrade/dump.c
@@ -4,7 +4,7 @@
  *	dump functions
  *
  *	Copyright (c) 2010-2015, PostgreSQL Global Development Group
- *	contrib/pg_upgrade/dump.c
+ *	src/bin/pg_upgrade/dump.c
  */
 
 #include "postgres_fe.h"
diff --git a/contrib/pg_upgrade/exec.c b/src/bin/pg_upgrade/exec.c
similarity index 99%
rename from contrib/pg_upgrade/exec.c
rename to src/bin/pg_upgrade/exec.c
index bf87419..7d31912 100644
--- a/contrib/pg_upgrade/exec.c
+++ b/src/bin/pg_upgrade/exec.c
@@ -4,7 +4,7 @@
  *	execution functions
  *
  *	Copyright (c) 2010-2015, PostgreSQL Global Development Group
- *	contrib/pg_upgrade/exec.c
+ *	src/bin/pg_upgrade/exec.c
  */
 
 #include "postgres_fe.h"
diff --git a/contrib/pg_upgrade/file.c b/src/bin/pg_upgrade/file.c
similarity index 99%
rename from contrib/pg_upgrade/file.c
rename to src/bin/pg_upgrade/file.c
index 5a8d17a..79d9390 100644
--- a/contrib/pg_upgrade/file.c
+++ b/src/bin/pg_upgrade/file.c
@@ -4,7 +4,7 @@
  *	file system operations
  *
  *	Copyright (c) 2010-2015, PostgreSQL Global Development Group
- *	contrib/pg_upgrade/file.c
+ *	src/bin/pg_upgrade/file.c
  */
 
 #include "postgres_fe.h"
diff --git a/contrib/pg_upgrade/function.c b/src/bin/pg_upgrade/function.c
similarity index 99%
rename from contrib/pg_upgrade/function.c
rename to src/bin/pg_upgrade/function.c
index d8009d1..04492a5 100644
--- a/contrib/pg_upgrade/function.c
+++ b/src/bin/pg_upgrade/function.c
@@ -4,7 +4,7 @@
  *	server-side function support
  *
  *	Copyright (c) 2010-2015, PostgreSQL Global Development Group
- *	contrib/pg_upgrade/function.c
+ *	src/bin/pg_upgrade/function.c
  */
 
 #include "postgres_fe.h"
diff --git a/contrib/pg_upgrade/info.c b/src/bin/pg_upgrade/info.c
similarity index 99%
rename from contrib/pg_upgrade/info.c
rename to src/bin/pg_upgrade/info.c
index 1254934..c0a5601 100644
--- a/contrib/pg_upgrade/info.c
+++ b/src/bin/pg_upgrade/info.c
@@ -4,7 +4,7 @@
  *	information support functions
  *
  *	Copyright (c) 2010-2015, PostgreSQL Global Development Group
- *	contrib/pg_upgrade/info.c
+ *	src/bin/pg_upgrade/info.c
  */
 
 #include "postgres_fe.h"
diff --git a/contrib/pg_upgrade/option.c b/src/bin/pg_upgrade/option.c
similarity index 99%
rename from contrib/pg_upgrade/option.c
rename to src/bin/pg_upgrade/option.c
index 9b387be..ce339ce 100644
--- a/contrib/pg_upgrade/option.c
+++ b/src/bin/pg_upgrade/option.c
@@ -4,7 +4,7 @@
  *	options functions
  *
  *	Copyright (c) 2010-2015, PostgreSQL Global Development Group
- *	contrib/pg_upgrade/option.c
+ *	src/bin/pg_upgrade/option.c
  */
 
 #include "postgres_fe.h"
diff --git a/contrib/pg_upgrade/page.c b/src/bin/pg_upgrade/page.c
similarity index 99%
rename from contrib/pg_upgrade/page.c
rename to src/bin/pg_upgrade/page.c
index 1cfc10f..3f4c697 100644
--- a/contrib/pg_upgrade/page.c
+++ b/src/bin/pg_upgrade/page.c
@@ -4,7 +4,7 @@
  *	per-page conversion operations
  *
  *	Copyright (c) 2010-2015, PostgreSQL Global Development Group
- *	contrib/pg_upgrade/page.c
+ *	src/bin/pg_upgrade/page.c
  */
 
 #include "postgres_fe.h"
diff --git a/contrib/pg_upgrade/parallel.c b/src/bin/pg_upgrade/parallel.c
similarity index 99%
rename from contrib/pg_upgrade/parallel.c
rename to src/bin/pg_upgrade/parallel.c
index 6da9965..c6978b5 100644
--- a/contrib/pg_upgrade/parallel.c
+++ b/src/bin/pg_upgrade/parallel.c
@@ -4,7 +4,7 @@
  *	multi-process support
  *
  *	Copyright (c) 2010-2015, PostgreSQL Global Development Group
- *	contrib/pg_upgrade/parallel.c
+ *	src/bin/pg_upgrade/parallel.c
  */
 
 #include "postgres_fe.h"
diff --git a/contrib/pg_upgrade/pg_upgrade.c b/src/bin/pg_upgrade/pg_upgrade.c
similarity index 99%
rename from contrib/pg_upgrade/pg_upgrade.c
rename to src/bin/pg_upgrade/pg_upgrade.c
index 1ff01a7..0333a91 100644
--- a/contrib/pg_upgrade/pg_upgrade.c
+++ b/src/bin/pg_upgrade/pg_upgrade.c
@@ -4,7 +4,7 @@
  *	main source file
  *
  *	Copyright (c) 2010-2015, PostgreSQL Global Development Group
- *	contrib/pg_upgrade/pg_upgrade.c
+ *	src/bin/pg_upgrade/pg_upgrade.c
  */
 
 /*
diff --git a/contrib/pg_upgrade/pg_upgrade.h b/src/bin/pg_upgrade/pg_upgrade.h
similarity index 99%
rename from contrib/pg_upgrade/pg_upgrade.h
rename to src/bin/pg_upgrade/pg_upgrade.h
index f9c239d..bc81acb 100644
--- a/contrib/pg_upgrade/pg_upgrade.h
+++ b/src/bin/pg_upgrade/pg_upgrade.h
@@ -2,7 +2,7 @@
  *	pg_upgrade.h
  *
  *	Copyright (c) 2010-2015, PostgreSQL Global Development Group
- *	contrib/pg_upgrade/pg_upgrade.h
+ *	src/bin/pg_upgrade/pg_upgrade.h
  */
 
 #include <unistd.h>
diff --git a/contrib/pg_upgrade/relfilenode.c b/src/bin/pg_upgrade/relfilenode.c
similarity index 99%
rename from contrib/pg_upgrade/relfilenode.c
rename to src/bin/pg_upgrade/relfilenode.c
index 423802b..fe05880 100644
--- a/contrib/pg_upgrade/relfilenode.c
+++ b/src/bin/pg_upgrade/relfilenode.c
@@ -4,7 +4,7 @@
  *	relfilenode functions
  *
  *	Copyright (c) 2010-2015, PostgreSQL Global Development Group
- *	contrib/pg_upgrade/relfilenode.c
+ *	src/bin/pg_upgrade/relfilenode.c
  */
 
 #include "postgres_fe.h"
diff --git a/contrib/pg_upgrade/server.c b/src/bin/pg_upgrade/server.c
similarity index 99%
rename from contrib/pg_upgrade/server.c
rename to src/bin/pg_upgrade/server.c
index c5f66f0..8d8e7d7 100644
--- a/contrib/pg_upgrade/server.c
+++ b/src/bin/pg_upgrade/server.c
@@ -4,7 +4,7 @@
  *	database server functions
  *
  *	Copyright (c) 2010-2015, PostgreSQL Global Development Group
- *	contrib/pg_upgrade/server.c
+ *	src/bin/pg_upgrade/server.c
  */
 
 #include "postgres_fe.h"
diff --git a/contrib/pg_upgrade/tablespace.c b/src/bin/pg_upgrade/tablespace.c
similarity index 98%
rename from contrib/pg_upgrade/tablespace.c
rename to src/bin/pg_upgrade/tablespace.c
index eecdf4b..ce7097e 100644
--- a/contrib/pg_upgrade/tablespace.c
+++ b/src/bin/pg_upgrade/tablespace.c
@@ -4,7 +4,7 @@
  *	tablespace functions
  *
  *	Copyright (c) 2010-2015, PostgreSQL Global Development Group
- *	contrib/pg_upgrade/tablespace.c
+ *	src/bin/pg_upgrade/tablespace.c
  */
 
 #include "postgres_fe.h"
diff --git a/contrib/pg_upgrade/test.sh b/src/bin/pg_upgrade/test.sh
similarity index 97%
rename from contrib/pg_upgrade/test.sh
rename to src/bin/pg_upgrade/test.sh
index 2e9f976..0903f30 100644
--- a/contrib/pg_upgrade/test.sh
+++ b/src/bin/pg_upgrade/test.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# contrib/pg_upgrade/test.sh
+# src/bin/pg_upgrade/test.sh
 #
 # Test driver for pg_upgrade.  Initializes a new database cluster,
 # runs the regression tests (to put in some data), runs pg_dumpall,
@@ -21,7 +21,7 @@ unset MAKELEVEL
 # authentication configuration.
 standard_initdb() {
 	"$1" -N
-	../../src/test/regress/pg_regress --config-auth "$PGDATA"
+	../../test/regress/pg_regress --config-auth "$PGDATA"
 }
 
 # Establish how the server will listen for connections
@@ -92,9 +92,9 @@ fi
 
 : ${oldbindir=$bindir}
 
-: ${oldsrc=../..}
+: ${oldsrc=../../..}
 oldsrc=`cd "$oldsrc" && pwd`
-newsrc=`cd ../.. && pwd`
+newsrc=`cd ../../.. && pwd`
 
 PATH=$bindir:$PATH
 export PATH
diff --git a/contrib/pg_upgrade/util.c b/src/bin/pg_upgrade/util.c
similarity index 99%
rename from contrib/pg_upgrade/util.c
rename to src/bin/pg_upgrade/util.c
index ec18526..6856fc8 100644
--- a/contrib/pg_upgrade/util.c
+++ b/src/bin/pg_upgrade/util.c
@@ -4,7 +4,7 @@
  *	utility functions
  *
  *	Copyright (c) 2010-2015, PostgreSQL Global Development Group
- *	contrib/pg_upgrade/util.c
+ *	src/bin/pg_upgrade/util.c
  */
 
 #include "postgres_fe.h"
diff --git a/contrib/pg_upgrade/version.c b/src/bin/pg_upgrade/version.c
similarity index 99%
rename from contrib/pg_upgrade/version.c
rename to src/bin/pg_upgrade/version.c
index 4ae9511..e3e7387 100644
--- a/contrib/pg_upgrade/version.c
+++ b/src/bin/pg_upgrade/version.c
@@ -4,7 +4,7 @@
  *	Postgres-version-specific routines
  *
  *	Copyright (c) 2010-2015, PostgreSQL Global Development Group
- *	contrib/pg_upgrade/version.c
+ *	src/bin/pg_upgrade/version.c
  */
 
 #include "postgres_fe.h"
diff --git a/src/tools/msvc/vcregress.pl b/src/tools/msvc/vcregress.pl
index bd3dd2c..4812a03 100644
--- a/src/tools/msvc/vcregress.pl
+++ b/src/tools/msvc/vcregress.pl
@@ -269,7 +269,7 @@ sub upgradecheck
 
 	$ENV{PGHOST} = 'localhost';
 	$ENV{PGPORT} ||= 50432;
-	my $tmp_root = "$topdir/contrib/pg_upgrade/tmp_check";
+	my $tmp_root = "$topdir/src/bin/pg_upgrade/tmp_check";
 	(mkdir $tmp_root || die $!) unless -d $tmp_root;
 	my $tmp_install = "$tmp_root/install";
 	print "Setting up temp install\n\n";
@@ -282,7 +282,7 @@ sub upgradecheck
 	$ENV{PATH} = "$bindir;$ENV{PATH}";
 	my $data = "$tmp_root/data";
 	$ENV{PGDATA} = "$data.old";
-	my $logdir = "$topdir/contrib/pg_upgrade/log";
+	my $logdir = "$topdir/src/bin/pg_upgrade/log";
 	(mkdir $logdir || die $!) unless -d $logdir;
 	print "\nRunning initdb on old cluster\n\n";
 	standard_initdb() or exit 1;
@@ -292,7 +292,7 @@ sub upgradecheck
 	installcheck();
 
 	# now we can chdir into the source dir
-	chdir "$topdir/contrib/pg_upgrade";
+	chdir "$topdir/src/bin/pg_upgrade";
 	print "\nDumping old cluster\n\n";
 	system("pg_dumpall -f $tmp_root/dump1.sql") == 0 or exit 1;
 	print "\nStopping old cluster\n\n";
-- 
2.3.2

