diff src/org/tmatesoft/hg/core/HgPushCommand.java @ 671:002ed1b2baad

AIOOBE in BundleGenerator.ChunkGenerator.iterate when there are no outgoing changes on push
author Artem Tikhomirov <tikhomirov.artem@gmail.com>
date Fri, 12 Jul 2013 15:29:37 +0200
parents 52af7f62e731
children
line wrap: on
line diff
--- a/src/org/tmatesoft/hg/core/HgPushCommand.java	Fri Jul 12 15:27:43 2013 +0200
+++ b/src/org/tmatesoft/hg/core/HgPushCommand.java	Fri Jul 12 15:29:37 2013 +0200
@@ -87,13 +87,14 @@
 			} else {
 				outgoing = new RevisionSet(l);
 			}
+			HgBundle b = null;
 			if (!outgoing.isEmpty()) {
 				//
 				// prepare bundle
 				BundleGenerator bg = new BundleGenerator(implRepo);
 				File bundleFile = bg.create(outgoing.asList());
 				progress.worked(20);
-				HgBundle b = new HgLookup(repo.getSessionContext()).loadBundle(bundleFile);
+				b = new HgLookup(repo.getSessionContext()).loadBundle(bundleFile);
 				//
 				// send changes
 				remoteRepo.unbundle(b, comparator.getRemoteHeads());
@@ -137,7 +138,9 @@
 			}
 			// XXX WTF is obsolete in namespaces key??
 			progress.worked(5);
-			b.unlink(); // keep the file only in case of failure
+			if (b != null) {
+				b.unlink(); // keep the file only in case of failure
+			}
 		} catch (IOException ex) {
 			throw new HgIOException(ex.getMessage(), null); // XXX not a nice idea to throw IOException from BundleGenerator#create
 		} catch (HgRepositoryNotFoundException ex) {