@ -181,16 +181,10 @@ public class PullCommand extends GitCommand<PullResult> {
String remoteBranchName = repoConfig . getString (
String remoteBranchName = repoConfig . getString (
ConfigConstants . CONFIG_BRANCH_SECTION , branchName ,
ConfigConstants . CONFIG_BRANCH_SECTION , branchName ,
ConfigConstants . CONFIG_KEY_MERGE ) ;
ConfigConstants . CONFIG_KEY_MERGE ) ;
boolean doRebase = false ;
if ( remoteBranchName = = null ) {
// check if the branch is configured for pull-rebase
// check if the branch is configured for pull-rebase
remoteBranchNam e = repoConfig . getString (
boolean doRebase = repoConfig . getBoolean (
ConfigConstants . CONFIG_BRANCH_SECTION , branchName ,
ConfigConstants . CONFIG_BRANCH_SECTION , branchName ,
ConfigConstants . CONFIG_KEY_REBASE ) ;
ConfigConstants . CONFIG_KEY_REBASE , false ) ;
if ( remoteBranchName ! = null ) {
doRebase = true ;
}
}
if ( remoteBranchName = = null ) {
if ( remoteBranchName = = null ) {
String missingKey = ConfigConstants . CONFIG_BRANCH_SECTION + DOT
String missingKey = ConfigConstants . CONFIG_BRANCH_SECTION + DOT
@ -237,29 +231,10 @@ public class PullCommand extends GitCommand<PullResult> {
JGitText . get ( ) . operationCanceled ,
JGitText . get ( ) . operationCanceled ,
JGitText . get ( ) . pullTaskName ) ) ;
JGitText . get ( ) . pullTaskName ) ) ;
PullResult result ;
if ( doRebase ) {
RebaseCommand rebase = new RebaseCommand ( repo ) ;
try {
RebaseResult rebaseRes = rebase . setUpstream ( remoteBranchName )
. setProgressMonitor ( monitor ) . setOperation (
Operation . BEGIN ) . call ( ) ;
result = new PullResult ( fetchRes , remote , rebaseRes ) ;
} catch ( NoHeadException e ) {
throw new JGitInternalException ( e . getMessage ( ) , e ) ;
} catch ( RefNotFoundException e ) {
throw new JGitInternalException ( e . getMessage ( ) , e ) ;
} catch ( JGitInternalException e ) {
throw new JGitInternalException ( e . getMessage ( ) , e ) ;
} catch ( GitAPIException e ) {
throw new JGitInternalException ( e . getMessage ( ) , e ) ;
}
} else {
// we check the updates to see which of the updated branches
// we check the updates to see which of the updated branches
// corresponds
// corresponds
// to the remote branch name
// to the remote branch name
AnyObjectId commitToMerge ;
AnyObjectId commitToMerge ;
if ( isRemote ) {
if ( isRemote ) {
Ref r = null ;
Ref r = null ;
if ( fetchRes ! = null ) {
if ( fetchRes ! = null ) {
@ -269,9 +244,8 @@ public class PullCommand extends GitCommand<PullResult> {
+ remoteBranchName ) ;
+ remoteBranchName ) ;
}
}
if ( r = = null )
if ( r = = null )
throw new JGitInternalException ( MessageFormat . format (
throw new JGitInternalException ( MessageFormat . format ( JGitText
JGitText . get ( ) . couldNotGetAdvertisedRef ,
. get ( ) . couldNotGetAdvertisedRef , remoteBranchName ) ) ;
remoteBranchName ) ) ;
else
else
commitToMerge = r . getObjectId ( ) ;
commitToMerge = r . getObjectId ( ) ;
} else {
} else {
@ -283,6 +257,25 @@ public class PullCommand extends GitCommand<PullResult> {
e ) ;
e ) ;
}
}
}
}
PullResult result ;
if ( doRebase ) {
RebaseCommand rebase = new RebaseCommand ( repo ) ;
try {
RebaseResult rebaseRes = rebase . setUpstream ( commitToMerge )
. setProgressMonitor ( monitor ) . setOperation (
Operation . BEGIN ) . call ( ) ;
result = new PullResult ( fetchRes , remote , rebaseRes ) ;
} catch ( NoHeadException e ) {
throw new JGitInternalException ( e . getMessage ( ) , e ) ;
} catch ( RefNotFoundException e ) {
throw new JGitInternalException ( e . getMessage ( ) , e ) ;
} catch ( JGitInternalException e ) {
throw new JGitInternalException ( e . getMessage ( ) , e ) ;
} catch ( GitAPIException e ) {
throw new JGitInternalException ( e . getMessage ( ) , e ) ;
}
} else {
MergeCommand merge = new MergeCommand ( repo ) ;
MergeCommand merge = new MergeCommand ( repo ) ;
merge . include (
merge . include (
"branch \'" + remoteBranchName + "\' of " + remoteUri ,
"branch \'" + remoteBranchName + "\' of " + remoteUri ,