| author | Maciej Bendkowski | 2012-08-09 05:06:38 (EDT) |
|---|---|---|
| committer | Malgorzata Janczarska | 2012-08-09 09:52:25 (EDT) |
| commit | fc33af6fad4bed6e45576eea26efa212c8c6a377 (patch) (side-by-side diff) | |
| tree | e389f9789784c244683cc7b6ce3c3fa3b40d41de | |
| parent | af588f5663da0b4a642b96f0f9da053deaa41450 (diff) | |
| download | org.eclipse.orion.client-fc33af6fad4bed6e45576eea26efa212c8c6a377.zip org.eclipse.orion.client-fc33af6fad4bed6e45576eea26efa212c8c6a377.tar.gz org.eclipse.orion.client-fc33af6fad4bed6e45576eea26efa212c8c6a377.tar.bz2 | |
Bug 382399 - Force Push prompts too many timesv20120809-1352
| -rw-r--r-- | bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js | 30 |
1 files changed, 27 insertions, 3 deletions
diff --git a/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js b/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js index 4841e9f..fc31a06 100644 --- a/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js +++ b/bundles/org.eclipse.orion.client.git/web/orion/git/gitCommands.js @@ -1386,8 +1386,21 @@ var exports = {}; spriteClass: "gitCommandSprite", //$NON-NLS-0$ id : "eclipse.orion.git.pushForce", //$NON-NLS-0$ callback: function(data) { - if(!confirm(messages["You're going to override content of the remote branch. This can cause the remote repository to lose commits."]+"\n\n"+messages['Are you sure?'])) //$NON-NLS-1$ - return; + // previously confirmed warnings + var confirmedWarnings = data.confirmedWarnings; + + // previously target branch + var itemTargetBranch = data.targetBranch; + + if(!confirmedWarnings){ + if(!confirm(messages["You're going to override content of the remote branch. This can cause the remote repository to lose commits."]+"\n\n"+messages['Are you sure?'])){ //$NON-NLS-1$ + return; + } else { + data.confirmedWarnings = true; + confirmedWarnings = true; + } + } + var target; var item = data.items; var path = dojo.hash(); @@ -1475,6 +1488,11 @@ var exports = {}; result.then( function(remotes){ + if(itemTargetBranch){ + handlePush(options, itemTargetBranch.Location, "HEAD", itemTargetBranch.Name, true); + return; + } + var dialog = new orion.git.widgets.RemotePrompterDialog({ title: messages["Choose Branch"], serviceRegistry: serviceRegistry, @@ -1491,14 +1509,17 @@ var exports = {}; else{ target = targetBranch; } + var locationToUpdate = "/gitapi/config/" + "branch." + item.Name + ".remote" + "/clone/file/" + parts[4]; gitService.addCloneConfigurationProperty(locationToChange,"branch." + item.Name + ".remote" ,target.parent.Name).then( function(){ + commandInvocation.targetBranch = target; handlePush(options, target.Location, "HEAD",target.Name, true); }, function(err){ if(err.status == 409){ //when confing entry is already defined we have to edit it gitService.editCloneConfigurationProperty(locationToUpdate,target.parent.Name).then( function(){ + commandInvocation.targetBranch = target; handlePush(options, target.Location, "HEAD",target.Name, true); } ); @@ -1518,7 +1539,10 @@ var exports = {}; gitClient: gitService, dialog: dialog2, location: item.RemoteLocation[0].Children[0].Name, - func: dojo.hitch(this, function(){handlePush(options,item.RemoteLocation[0].Children[0].Location, "HEAD", path, true);}) + func: dojo.hitch(this, function(){ + commandInvocation.targetBranch = item.RemoteLocation[0].Children[0]; + handlePush(options,item.RemoteLocation[0].Children[0].Location, "HEAD", path, true); + }) }); } |

