auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private void renderSubmitType ( java.lang.String action ) { try { com.google.gerrit.extensions.client.SubmitType type = com.google.gerrit.extensions.client.SubmitType.valueOf ( action ) ; submitActionText.setInnerText ( com.google.gerrit.client.admin.Util.toLongString ( type ) ) ; } catch ( java.lang.IllegalArgumentException e ) { submitActionText.setInnerText ( action ) ; } }

Target:
private void renderSubmitType ( com.google.gerrit.reviewdb.client.Change.Status status , boolean canSubmit , com.google.gerrit.extensions.client.SubmitType submitType ) { if ( canSubmit && ( status == ( com.google.gerrit.reviewdb.client.Change.Status.NEW ) ) ) { statusText.setInnerText ( ( changeInfo.mergeable ( ) ? Util.C.readyToSubmit ( ) : Util.C.mergeConflict ( ) ) ) ; } setVisible ( notMergeable , ( ! ( changeInfo.mergeable ( ) ) ) ) ; submitActionText.setInnerText ( com.google.gerrit.client.admin.Util.toLongString ( submitType ) ) ; }
Source:
com.google.gerrit.server.git.BatchUpdate getUpdate ( ) { com.google.common.base.Preconditions.checkState ( ( ( db ) != null ) , "call setContext before getUpdate" ) ; if ( ( update ) == null ) { update = batchUpdateFactory.create ( db , getProjectName ( ) , caller , ts ) ; update.setRepository ( repo , rw , ins ) ; } return update ; }

Target:
com.google.gerrit.server.git.BatchUpdate getUpdate ( ) { com.google.common.base.Preconditions.checkState ( ( ( db ) != null ) , "call setContext before getUpdate" ) ; if ( ( update ) == null ) { update = batchUpdateFactory.create ( db , getProjectName ( ) , caller , ts ) . setRepository ( repo , rw , ins ) . setRequestId ( submissionId ) ; } return update ; }
Source:
private static void addChildren ( java.util.Map < java.lang.String , java.util.List < com.google.gerrit.reviewdb.client.PatchLineComment > > parentMap , java.util.List < com.google.gerrit.reviewdb.client.PatchLineComment > children , java.util.List < com.google.gerrit.reviewdb.client.PatchLineComment > outResult ) { if ( children != null ) { for ( com.google.gerrit.reviewdb.client.PatchLineComment c : children ) { outResult.add ( c ) ; com.google.gerrit.common.data.CommentDetail.addChildren ( parentMap , parentMap.get ( c.getKey ( ) . get ( ) ) , outResult ) ; } } }

Target:
private static void addChildren ( java.util.Map < java.lang.String , java.util.List < com.google.gerrit.reviewdb.client.Comment > > parentMap , java.util.List < com.google.gerrit.reviewdb.client.Comment > children , java.util.List < com.google.gerrit.reviewdb.client.Comment > outResult ) { if ( children != null ) { for ( com.google.gerrit.reviewdb.client.Comment c : children ) { outResult.add ( c ) ; com.google.gerrit.common.data.CommentDetail.addChildren ( parentMap , parentMap.get ( c.key.uuid ) , outResult ) ; } } }
Source:
public void setUpInjector ( ) throws java.lang.Exception { config.setInt ( "index" , null , "maxPages" , 10 ) ; lifecycle = new com.google.gerrit.lifecycle.LifecycleManager ( ) ; com.google.inject.Injector injector = createInjector ( ) ; lifecycle.add ( injector ) ; injector.injectMembers ( this ) ; lifecycle.start ( ) ; db = schemaFactory.open ( ) ; schemaCreator.create ( db ) ; userId = accountManager.authenticate ( com.google.gerrit.server.account.AuthRequest.forUser ( "user" ) ) . getAccountId ( ) ; com.google.gerrit.reviewdb.client.Account userAccount = db.accounts ( ) . get ( userId ) ; userAccount.setPreferredEmail ( "user@example.com" ) ; db.accounts ( ) . update ( com.google.common.collect.ImmutableList.of ( userAccount ) ) ; user = userFactory.create ( com.google.inject.util.Providers.of ( db ) , userId ) ; requestContext.setContext ( newRequestContext ( userAccount.getId ( ) ) ) ; }

Target:
public void setUpConfig ( ) throws java.lang.Exception { config.setInt ( "index" , null , "maxPages" , 10 ) ; }
Source:
public static com.google.gerrit.extensions.client.GeneralPreferencesInfo defaults ( ) { com.google.gerrit.extensions.client.GeneralPreferencesInfo p = new com.google.gerrit.extensions.client.GeneralPreferencesInfo ( ) ; p.changesPerPage = com.google.gerrit.extensions.client.GeneralPreferencesInfo.DEFAULT_PAGESIZE ; p.showSiteHeader = true ; p.useFlashClipboard = true ; p.emailStrategy = com.google.gerrit.extensions.client.GeneralPreferencesInfo.EmailStrategy.ENABLED ; p.reviewCategoryStrategy = com.google.gerrit.extensions.client.GeneralPreferencesInfo.ReviewCategoryStrategy.NONE ; p.downloadScheme = null ; p.downloadCommand = com.google.gerrit.extensions.client.GeneralPreferencesInfo.DownloadCommand.CHECKOUT ; p.dateFormat = com.google.gerrit.extensions.client.GeneralPreferencesInfo.DateFormat.STD ; p.timeFormat = com.google.gerrit.extensions.client.GeneralPreferencesInfo.TimeFormat.HHMM_12 ; p.relativeDateInChangeTable = false ; p.diffView = com.google.gerrit.extensions.client.GeneralPreferencesInfo.DiffView.SIDE_BY_SIDE ; p.sizeBarInChangeTable = true ; p.legacycidInChangeTable = false ; p.muteCommonPathPrefixes = true ; return p ; }

Target:
public static com.google.gerrit.extensions.client.GeneralPreferencesInfo defaults ( ) { com.google.gerrit.extensions.client.GeneralPreferencesInfo p = new com.google.gerrit.extensions.client.GeneralPreferencesInfo ( ) ; p.changesPerPage = com.google.gerrit.extensions.client.GeneralPreferencesInfo.DEFAULT_PAGESIZE ; p.showSiteHeader = true ; p.useFlashClipboard = true ; p.emailStrategy = com.google.gerrit.extensions.client.GeneralPreferencesInfo.EmailStrategy.ENABLED ; p.reviewCategoryStrategy = com.google.gerrit.extensions.client.GeneralPreferencesInfo.ReviewCategoryStrategy.NONE ; p.downloadScheme = null ; p.downloadCommand = com.google.gerrit.extensions.client.GeneralPreferencesInfo.DownloadCommand.CHECKOUT ; p.dateFormat = com.google.gerrit.extensions.client.GeneralPreferencesInfo.DateFormat.STD ; p.timeFormat = com.google.gerrit.extensions.client.GeneralPreferencesInfo.TimeFormat.HHMM_12 ; p.relativeDateInChangeTable = false ; p.diffView = com.google.gerrit.extensions.client.GeneralPreferencesInfo.DiffView.SIDE_BY_SIDE ; p.sizeBarInChangeTable = true ; p.legacycidInChangeTable = false ; p.muteCommonPathPrefixes = true ; p.signedOffBy = false ; return p ; }
Source:
public com.google.gerrit.server.restapi.change.Description getDescription ( com.google.gerrit.server.change.ChangeResource rsrc ) { return new com.google.gerrit.server.restapi.change.Description ( ) . setLabel ( "WIP" ) . setTitle ( "Set Work In Progress" ) . setVisible ( ( ( ( rsrc.isUserOwner ( ) ) && ( ( rsrc.getChange ( ) . getStatus ( ) ) == ( com.google.gerrit.reviewdb.client.Change.Status.NEW ) ) ) && ( ! ( rsrc.getChange ( ) . isWorkInProgress ( ) ) ) ) ) ; }

Target:
public com.google.gerrit.server.restapi.change.Description getDescription ( com.google.gerrit.server.change.ChangeResource rsrc ) { return new com.google.gerrit.server.restapi.change.Description ( ) . setLabel ( "WIP" ) . setTitle ( "Set Work In Progress" ) . setVisible ( com.google.gerrit.extensions.conditions.BooleanCondition.and ( ( ( ( rsrc.getChange ( ) . getStatus ( ) ) == ( com.google.gerrit.reviewdb.client.Change.Status.NEW ) ) && ( ! ( rsrc.getChange ( ) . isWorkInProgress ( ) ) ) ) , com.google.gerrit.extensions.conditions.BooleanCondition.or ( rsrc.isUserOwner ( ) , permissionBackend.currentUser ( ) . testCond ( GlobalPermission.ADMINISTRATE_SERVER ) ) ) ) ; }
Source:
public org.junit.runners.model.Statement apply ( org.junit.runners.model.Statement statement , org.junit.runner.Description description ) { return new org.junit.runners.model.Statement ( ) { @ java.lang.Override public void evaluate ( ) throws java.lang.Throwable { try { setUp ( ) ; statement.evaluate ( ) ; } finally { tearDown ( ) ; } } } ; }

Target:
public org.junit.runners.model.Statement apply ( org.junit.runners.model.Statement base , org.junit.runners.model.FrameworkMethod method , java.lang.Object target ) { return new org.junit.runners.model.Statement ( ) { @ java.lang.Override public void evaluate ( ) throws java.lang.Throwable { try { setUp ( target ) ; base.evaluate ( ) ; } finally { tearDown ( ) ; } } } ; }
Source:
private void createLock ( java.lang.String project , com.googlesource.gerrit.plugins.lfs.locks.LfsLocksContext action ) throws java.io.IOException { com.googlesource.gerrit.plugins.lfs.locks.LfsCreateLockInput input = action.input ( com.googlesource.gerrit.plugins.lfs.locks.LfsCreateLockInput.class ) ; com.googlesource.gerrit.plugins.lfs.locks.LfsPutLocksAction.log.debug ( "Create lock for in project {}" , input.path , project ) ; com.googlesource.gerrit.plugins.lfs.locks.LfsLock lock = new com.googlesource.gerrit.plugins.lfs.locks.LfsLock ( "random_id" , input.path , now ( ) , new com.googlesource.gerrit.plugins.lfs.locks.LfsLockOwner ( "Lock Owner <lock_owner@example.com>" ) ) ; action.sendResponse ( lock ) ; }

Target:
protected void authorizeUser ( com.google.gerrit.server.project.ProjectControl control ) throws org.eclipse.jgit.lfs.errors.LfsUnauthorized { if ( ( com.google.gerrit.common.data.Capable.OK ) != ( control.canPushToAtLeastOneRef ( ) ) ) { throwUnauthorizedOp ( action.getName ( ) , control ) ; } }
Source:
public com.google.gerrit.extensions.restapi.Response < java.lang.String > apply ( com.google.gerrit.server.change.ChangeResource rsrc , com.google.gerrit.server.change.Unignore.Input input ) throws com.google.gerrit.extensions.restapi.RestApiException { try { if ( ( rsrc.isUserOwner ( ) ) || ( ! ( isIgnored ( rsrc ) ) ) ) { return com.google.gerrit.extensions.restapi.Response.ok ( "" ) ; } stars.unignore ( rsrc ) ; } catch ( com.google.gwtorm.server.OrmException e ) { throw new com.google.gerrit.extensions.restapi.RestApiException ( "failed to unignore change" , e ) ; } return com.google.gerrit.extensions.restapi.Response.ok ( "" ) ; }

Target:
public com.google.gerrit.extensions.restapi.Response < java.lang.String > apply ( com.google.gerrit.server.change.ChangeResource rsrc , com.google.gerrit.server.change.Unignore.Input input ) throws com.google.gerrit.extensions.restapi.RestApiException { try { if ( canUnignore ( rsrc ) ) { stars.unignore ( rsrc ) ; } return com.google.gerrit.extensions.restapi.Response.ok ( "" ) ; } catch ( com.google.gwtorm.server.OrmException e ) { throw new com.google.gerrit.extensions.restapi.RestApiException ( "failed to unignore change" , e ) ; } }
Source:
public com.google.gerrit.server.config.PluginConfig get ( com.google.gerrit.reviewdb.client.Project.NameKey projectName , java.lang.String pluginName ) throws com.google.gerrit.server.project.NoSuchProjectException { com.google.gerrit.server.project.ProjectState projectState = projectCache.get ( projectName ) ; if ( projectState == null ) { throw new com.google.gerrit.server.project.NoSuchProjectException ( projectName ) ; } return projectState.getConfig ( ) . getPluginConfig ( pluginName ) ; }

Target:
public com.google.gerrit.server.config.PluginConfig getFromProjectConfig ( com.google.gerrit.reviewdb.client.Project.NameKey projectName , java.lang.String pluginName ) throws com.google.gerrit.server.project.NoSuchProjectException { com.google.gerrit.server.project.ProjectState projectState = projectCache.get ( projectName ) ; if ( projectState == null ) { throw new com.google.gerrit.server.project.NoSuchProjectException ( projectName ) ; } return projectState.getConfig ( ) . getPluginConfig ( pluginName ) ; }
Source:
private void display ( com.googlesource.gerrit.plugins.serviceuser.client.ServiceUserInfo info ) { com.googlesource.gerrit.plugins.serviceuser.client.ServiceUserScreen.MyTable t = new com.googlesource.gerrit.plugins.serviceuser.client.ServiceUserScreen.MyTable ( ) ; t.addRow ( "Username" , info.username ( ) ) ; t.addRow ( "Full Name" , info.name ( ) ) ; t.addRow ( "Email Address" , info.email ( ) ) ; t.addRow ( "Created By" , info.created_by ( ) ) ; t.addRow ( "Created At" , info.created_at ( ) ) ; add ( t ) ; }

Target:
private void display ( com.googlesource.gerrit.plugins.serviceuser.client.ServiceUserInfo info ) { com.googlesource.gerrit.plugins.serviceuser.client.ServiceUserScreen.MyTable t = new com.googlesource.gerrit.plugins.serviceuser.client.ServiceUserScreen.MyTable ( ) ; t.addRow ( "Username" , info.username ( ) ) ; t.addRow ( "Full Name" , info.name ( ) ) ; t.addRow ( "Email Address" , info.email ( ) ) ; t.addRow ( "Created By" , info.created_by ( ) ) ; t.addRow ( "Created At" , info.created_at ( ) ) ; add ( t ) ; add ( new com.googlesource.gerrit.plugins.serviceuser.client.SshPanel ( info.username ( ) ) ) ; }
Source:
public T call ( ) throws java.lang.Exception { C old = threadLocal.get ( ) ; threadLocal.set ( ctx ) ; try { return callable.call ( ) ; } finally { if ( old != null ) { threadLocal.set ( old ) ; } else { threadLocal.remove ( ) ; } } }

Target:
protected final < T > java.util.concurrent.Callable < T > wrapImpl ( final java.util.concurrent.Callable < T > callable ) { C ctx = continuingContext ( requireContext ( ) ) ; return ( ) -> { C old = threadLocal.get ( ) ; threadLocal.set ( ctx ) ; try { return callable.call ( ) ; } finally { if ( old != null ) { threadLocal.set ( old ) ; } else { threadLocal.remove ( ) ; } } } ; }
Source:
public void createEmptyChange_MissingBranch ( ) throws java.lang.Exception { com.google.gerrit.extensions.common.ChangeInfo ci = new com.google.gerrit.extensions.common.ChangeInfo ( ) ; ci.project = project.get ( ) ; com.google.gerrit.acceptance.RestResponse r = adminSession.post ( "/changes/" , ci ) ; com.google.common.truth.Truth.assertThat ( r.getStatusCode ( ) ) . isEqualTo ( HttpStatus.SC_BAD_REQUEST ) ; com.google.common.truth.Truth.assertThat ( r.getEntityContent ( ) ) . contains ( "branch must be non-empty" ) ; }

Target:
public void createEmptyChange_MissingBranch ( ) throws java.lang.Exception { com.google.gerrit.extensions.common.ChangeInfo ci = new com.google.gerrit.extensions.common.ChangeInfo ( ) ; ci.project = project.get ( ) ; assertCreateFails ( ci , com.google.gerrit.extensions.restapi.BadRequestException.class , "branch must be non-empty" ) ; }
Source:
public void onClick ( final com.google.gwt.event.dom.client.ClickEvent event ) { b.setEnabled ( false ) ; Util.MANAGE_SVC.rebaseChange ( patchSet.getId ( ) , new com.google.gerrit.client.changes.ChangeDetailCache.GerritWidgetCallback ( b ) ) ; }

Target:
public void onClick ( final com.google.gwt.event.dom.client.ClickEvent event ) { b.setEnabled ( false ) ; final com.google.gerrit.reviewdb.client.Change.Id id = patchSet.getId ( ) . getParentKey ( ) ; com.google.gerrit.client.changes.ChangeApi.publish ( id.get ( ) , patchSet.getRevision ( ) . get ( ) , com.google.gerrit.client.change.DraftActions.cs ( id ) ) ; }
Source:
private void assertGetComment ( com.google.gerrit.server.change.RevisionResource res , com.google.gerrit.reviewdb.client.PatchLineComment expected , java.lang.String uuid ) throws java.lang.Exception { try { com.google.gerrit.server.change.CommentResource commentRes = comments.parse ( res , com.google.gerrit.extensions.restapi.IdString.fromUrl ( uuid ) ) ; if ( expected == null ) { org.junit.Assert.fail ( "Expected no comment" ) ; } com.google.gerrit.server.change.CommentInfo actual = getComment.apply ( commentRes ) ; com.google.gerrit.server.change.CommentsTest.assertComment ( expected , actual , true ) ; } catch ( com.google.gerrit.extensions.restapi.ResourceNotFoundException e ) { if ( expected != null ) { org.junit.Assert.fail ( "Expected to find comment" ) ; } } }

Target:
private void assertGetComment ( com.google.gerrit.server.change.RevisionResource res , com.google.gerrit.reviewdb.client.PatchLineComment expected , java.lang.String uuid ) throws java.lang.Exception { try { com.google.gerrit.server.change.CommentResource commentRes = comments.parse ( res , com.google.gerrit.extensions.restapi.IdString.fromUrl ( uuid ) ) ; if ( expected == null ) { org.junit.Assert.fail ( "Expected no comment" ) ; } com.google.gerrit.extensions.common.CommentInfo actual = getComment.apply ( commentRes ) ; com.google.gerrit.server.change.CommentsTest.assertComment ( expected , actual , true ) ; } catch ( com.google.gerrit.extensions.restapi.ResourceNotFoundException e ) { if ( expected != null ) { org.junit.Assert.fail ( "Expected to find comment" ) ; } } }
Source:
protected void configure ( ) { bind ( com.google.gerrit.server.index.ChangeIndex.class ) . to ( com.google.gerrit.lucene.LuceneChangeIndex.class ) ; bind ( com.google.gerrit.server.index.ChangeIndexer.class ) . to ( com.google.gerrit.server.index.ChangeIndexerImpl.class ) ; bind ( com.google.gerrit.server.query.change.IndexRewrite.class ) . to ( com.google.gerrit.server.query.change.IndexRewriteImpl.class ) ; listener ( ) . to ( com.google.gerrit.lucene.LuceneChangeIndex.class ) ; if ( checkVersion ) { listener ( ) . to ( com.google.gerrit.lucene.IndexVersionCheck.class ) ; } }

Target:
protected void configure ( ) { bind ( ChangeIndex.Manager.class ) . to ( com.google.gerrit.lucene.LuceneChangeIndexManager.class ) ; bind ( com.google.gerrit.server.index.ChangeIndexer.class ) . to ( com.google.gerrit.server.index.ChangeIndexerImpl.class ) ; bind ( com.google.gerrit.server.query.change.IndexRewrite.class ) . to ( com.google.gerrit.server.query.change.IndexRewriteImpl.class ) ; listener ( ) . to ( com.google.gerrit.lucene.LuceneChangeIndexManager.class ) ; if ( checkVersion ) { listener ( ) . to ( com.google.gerrit.lucene.IndexVersionCheck.class ) ; } }
Source:
public void testStop ( ) throws java.lang.Exception { resetAll ( ) ; executorMock.shutdown ( ) ; org.easymock.EasyMock.expectLastCall ( ) . once ( ) ; executorMock.unregisterWorkQueue ( ) ; org.easymock.EasyMock.expectLastCall ( ) . once ( ) ; replayAll ( ) ; syncEventsExecutorProvider.start ( ) ; com.google.common.truth.Truth.assertThat ( syncEventsExecutorProvider.get ( ) ) . isEqualTo ( executorMock ) ; syncEventsExecutorProvider.stop ( ) ; verifyAll ( ) ; com.google.common.truth.Truth.assertThat ( syncEventsExecutorProvider.get ( ) ) . isNull ( ) ; }

Target:
public void testStop ( ) throws java.lang.Exception { syncEventsExecutorProvider.start ( ) ; com.google.common.truth.Truth.assertThat ( syncEventsExecutorProvider.get ( ) ) . isEqualTo ( executorMock ) ; syncEventsExecutorProvider.stop ( ) ; org.mockito.Mockito.verify ( executorMock ) . shutdown ( ) ; org.mockito.Mockito.verify ( executorMock ) . unregisterWorkQueue ( ) ; com.google.common.truth.Truth.assertThat ( syncEventsExecutorProvider.get ( ) ) . isNull ( ) ; }
Source:
private void doClearPassword ( ) { if ( ( id ) != null ) { enableUI ( false ) ; Util.ACCOUNT_SEC.clearPassword ( id.getKey ( ) , new com.google.gerrit.client.rpc.GerritCallback < com.google.gerrit.reviewdb.client.AccountExternalId > ( ) { public void onSuccess ( final com.google.gerrit.reviewdb.client.AccountExternalId result ) { display ( result ) ; } @ java.lang.Override public void onFailure ( final java.lang.Throwable caught ) { enableUI ( true ) ; } } ) ; } }

Target:
private void doClearPassword ( ) { if ( ( id ) != null ) { enableUI ( false ) ; com.google.gerrit.client.account.AccountApi.clearHttpPassword ( "self" , new com.google.gerrit.client.rpc.GerritCallback < com.google.gerrit.client.VoidResult > ( ) { @ java.lang.Override public void onSuccess ( com.google.gerrit.client.VoidResult result ) { id.setPassword ( null ) ; display ( id ) ; } @ java.lang.Override public void onFailure ( final java.lang.Throwable caught ) { enableUI ( true ) ; } } ) ; } }
Source:
static com.google.gitiles.ArchiveFormat getDefault ( org.eclipse.jgit.lib.Config cfg ) { for ( java.lang.String allowed : cfg.getStringList ( "archive" , null , "format" ) ) { com.google.common.base.Optional < com.google.gitiles.ArchiveFormat > result = com.google.common.base.Enums.getIfPresent ( com.google.gitiles.ArchiveFormat.class , allowed.toUpperCase ( ) ) ; if ( result.isPresent ( ) ) { return result.get ( ) ; } } return com.google.gitiles.ArchiveFormat.TGZ ; }

Target:
static com.google.gitiles.ArchiveFormat getDefault ( org.eclipse.jgit.lib.Config cfg ) { for ( java.lang.String allowed : cfg.getStringList ( "archive" , null , "format" ) ) { com.google.gitiles.ArchiveFormat result = com.google.common.base.Enums.getIfPresent ( com.google.gitiles.ArchiveFormat.class , allowed.toUpperCase ( ) ) . orNull ( ) ; if ( result != null ) { return result ; } } return com.google.gitiles.ArchiveFormat.TGZ ; }
Source:
public void simpleChangeMessage ( ) { com.google.gerrit.server.mail.receive.MailMessage.Builder b = newMailMessageBuilder ( ) ; b.textContent ( ( "Looks good to me\n" + ( com.google.gerrit.server.mail.receive.TextParserTest.quotedFooter ) ) ) ; java.util.List < com.google.gerrit.reviewdb.client.Comment > comments = defaultComments ( ) ; java.util.List < com.google.gerrit.server.mail.receive.MailComment > parsedComments = com.google.gerrit.server.mail.receive.TextParser.parse ( b.build ( ) , comments , changeURL ) ; com.google.common.truth.Truth.assertThat ( parsedComments ) . hasSize ( 1 ) ; assertChangeMessage ( "Looks good to me" , parsedComments.get ( 0 ) ) ; }

Target:
public void simpleChangeMessage ( ) { com.google.gerrit.server.mail.receive.MailMessage.Builder b = newMailMessageBuilder ( ) ; b.textContent ( ( "Looks good to me\n" + ( com.google.gerrit.server.mail.receive.TextParserTest.quotedFooter ) ) ) ; java.util.List < com.google.gerrit.reviewdb.client.Comment > comments = defaultComments ( ) ; java.util.List < com.google.gerrit.server.mail.receive.MailComment > parsedComments = com.google.gerrit.server.mail.receive.TextParser.parse ( b.build ( ) , comments , com.google.gerrit.server.mail.receive.CHANGE_URL ) ; com.google.common.truth.Truth.assertThat ( parsedComments ) . hasSize ( 1 ) ; assertChangeMessage ( "Looks good to me" , parsedComments.get ( 0 ) ) ; }
Source:
public void onClick ( com.google.gwt.event.dom.client.ClickEvent event ) { onCellDoubleClick ( 0 , 2 ) ; }

Target:
private void appendLineNumberForSideB ( final com.google.gwtexpui.safehtml.client.SafeHtmlBuilder m , final int idx ) { m.openTd ( ) ; m.setStyleName ( Gerrit.RESOURCES.css ( ) . lineNumber ( ) ) ; m.append ( com.google.gwtexpui.safehtml.client.SafeHtml.asis ( ( ( "<a href=\"javascript:void(0)\">" + ( idx + 1 ) ) + "</a>" ) ) ) ; m.closeTd ( ) ; }
Source:
public void unblockMoreSpecificRefInLocal_Fails ( ) { com.google.gerrit.server.project.Util.block ( parent , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/heads/*" ) ; com.google.gerrit.server.project.Util.allow ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.DEVS , "refs/heads/master" ) ; com.google.gerrit.server.project.ProjectControl u = user ( local , com.google.gerrit.server.project.Util.DEVS ) ; assertCannotUpdate ( "refs/heads/master" , u ) ; }

Target:
public void unblockMoreSpecificRefWithExclusiveFlag ( ) { com.google.gerrit.server.project.testing.Util.block ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/heads/*" ) ; com.google.gerrit.server.project.testing.Util.allow ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.testing.Util.DEVS , "refs/heads/master" , true ) ; com.google.gerrit.server.project.ProjectControl u = user ( local , com.google.gerrit.server.project.testing.Util.DEVS ) ; assertCanUpdate ( "refs/heads/master" , u ) ; }
Source:
public void testGet ( ) throws java.lang.Exception { com.google.inject.Injector injector = com.google.inject.Guice.createInjector ( new com.ericsson.gerrit.plugins.syncindex.HttpClientProviderTest.TestModule ( ) ) ; org.apache.http.impl.client.CloseableHttpClient httpClient1 = injector.getInstance ( org.apache.http.impl.client.CloseableHttpClient.class ) ; com.google.common.truth.Truth.assertThat ( httpClient1 ) . isNotNull ( ) ; org.apache.http.impl.client.CloseableHttpClient httpClient2 = injector.getInstance ( org.apache.http.impl.client.CloseableHttpClient.class ) ; com.google.common.truth.Truth.assertThat ( httpClient1 ) . isEqualTo ( httpClient2 ) ; }

Target:
public void testGet ( ) throws java.lang.Exception { com.google.inject.Injector injector = com.google.inject.Guice.createInjector ( new com.ericsson.gerrit.plugins.highavailability.HttpClientProviderTest.TestModule ( ) ) ; org.apache.http.impl.client.CloseableHttpClient httpClient1 = injector.getInstance ( org.apache.http.impl.client.CloseableHttpClient.class ) ; com.google.common.truth.Truth.assertThat ( httpClient1 ) . isNotNull ( ) ; org.apache.http.impl.client.CloseableHttpClient httpClient2 = injector.getInstance ( org.apache.http.impl.client.CloseableHttpClient.class ) ; com.google.common.truth.Truth.assertThat ( httpClient1 ) . isEqualTo ( httpClient2 ) ; }
Source:
private java.lang.String getFormattedAudit ( com.google.gerrit.audit.AuditEvent action ) { return java.lang.String.format ( "%1$s | %2$s | %3$s | %4$s | %5$s | %6$s | %7$s | %8$s | %9$s | %10$s" , action.uuid.get ( ) , getFormattedTS ( action.when ) , action.sessionId , getFormattedAuditSingle ( action.who ) , getFormattedAuditSingle ( action ) , action.what , getFormattedAuditList ( action.params ) , getFormattedAuditSingle ( action.result ) , getFormattedTS ( action.timeAtStart ) , action.elapsed ) ; }

Target:
private java.lang.String getFormattedAudit ( com.google.gerrit.audit.AuditEvent action ) { return java.lang.String.format ( "%1$s | %2$s | %3$s | %4$s | %5$s | %6$s | %7$s | %8$s | %9$s | %10$s" , action.uuid.uuid ( ) , getFormattedTS ( action.when ) , action.sessionId , getFormattedAuditSingle ( action.who ) , getFormattedAuditSingle ( action ) , action.what , getFormattedAuditList ( action.params ) , getFormattedAuditSingle ( action.result ) , getFormattedTS ( action.timeAtStart ) , action.elapsed ) ; }
Source:
void remove ( com.google.gerrit.client.diff.SkipBar a , com.google.gerrit.client.diff.SkipBar b ) { skipBars.remove ( a ) ; skipBars.remove ( b ) ; if ( skipBars.isEmpty ( ) ) { skipBars = null ; } }

Target:
void remove ( com.google.gerrit.client.diff.SkipBar a , com.google.gerrit.client.diff.SkipBar b ) { skipBars.remove ( a ) ; skipBars.remove ( b ) ; if ( ( ( line0 ) == a ) || ( ( line0 ) == b ) ) { line0 = null ; } if ( skipBars.isEmpty ( ) ) { skipBars = null ; } }
Source:
public int compare ( com.google.gerrit.server.notedb.ChangeRebuilderImpl.Event a , com.google.gerrit.server.notedb.ChangeRebuilderImpl.Event b ) { return com.google.common.collect.ComparisonChain.start ( ) . compareTrueFirst ( a.predatesChange , b.predatesChange ) . compare ( a.when , b.when ) . compare ( a.who , b.who , com.google.gerrit.reviewdb.server.ReviewDbUtil.intKeyOrdering ( ) ) . compare ( a.psId.get ( ) , b.psId.get ( ) ) . result ( ) ; }

Target:
public int compare ( com.google.gerrit.server.notedb.ChangeRebuilderImpl.Event a , com.google.gerrit.server.notedb.ChangeRebuilderImpl.Event b ) { return com.google.common.collect.ComparisonChain.start ( ) . compareTrueFirst ( a.predatesChange , b.predatesChange ) . compare ( a.when , b.when ) . compare ( a.who , b.who , com.google.gerrit.reviewdb.server.ReviewDbUtil.intKeyOrdering ( ) ) . compare ( a.psId , b.psId , com.google.gerrit.reviewdb.server.ReviewDbUtil.intKeyOrdering ( ) . nullsLast ( ) ) . result ( ) ; }
Source:
public void mergeByOtherCcingSelfNotifyOwner ( ) throws java.lang.Exception { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageChange ( com.google.gerrit.server.account.WatchConfig.NotifyType.ALL_COMMENTS , com.google.gerrit.server.account.WatchConfig.NotifyType.SUBMITTED_CHANGES ) ; setEmailStrategy ( other , EmailStrategy.CC_ON_OWN_COMMENTS ) ; merge ( sc.changeId , other , com.google.gerrit.extensions.api.changes.NotifyHandling.OWNER ) ; assertThat ( sender ) . sent ( "merged" , sc ) . to ( sc.owner ) . notTo ( sc.reviewer , sc.ccer , sc.starrer , other ) . notTo ( sc.reviewerByEmail , sc.ccerByEmail ) . notTo ( com.google.gerrit.server.account.WatchConfig.NotifyType.ALL_COMMENTS , com.google.gerrit.server.account.WatchConfig.NotifyType.SUBMITTED_CHANGES ) ; }

Target:
public void mergeByOtherCcingSelfNotifyNone ( ) throws java.lang.Exception { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageChange ( ) ; setEmailStrategy ( other , EmailStrategy.CC_ON_OWN_COMMENTS ) ; merge ( sc.changeId , other , com.google.gerrit.extensions.api.changes.NotifyHandling.NONE ) ; assertThat ( sender ) . notSent ( ) ; }
Source:
public void normalize ( final com.google.gerrit.client.reviewdb.Project.Id projectId , final java.util.Collection < com.google.gerrit.client.reviewdb.ChangeApproval > approvals , final com.google.gwtorm.client.Transaction txn ) throws com.google.gwtorm.client.OrmException { final java.util.Map < com.google.gerrit.client.reviewdb.ApprovalCategory.Id , java.util.Collection < com.google.gerrit.client.reviewdb.ProjectRight > > rights ; rights = loadRights ( projectId ) ; for ( final com.google.gerrit.client.reviewdb.ChangeApproval a : approvals ) { if ( normalize ( rights , a ) ) { db.changeApprovals ( ) . update ( java.util.Collections.singleton ( a ) , txn ) ; } } }

Target:
private java.util.Map < com.google.gerrit.client.reviewdb.ApprovalCategory.Id , java.util.Collection < com.google.gerrit.client.reviewdb.ProjectRight > > loadRights ( final com.google.gerrit.client.data.ProjectCache.Entry e ) { final java.util.Map < com.google.gerrit.client.reviewdb.ApprovalCategory.Id , java.util.Collection < com.google.gerrit.client.reviewdb.ProjectRight > > r ; r = new java.util.HashMap < com.google.gerrit.client.reviewdb.ApprovalCategory.Id , java.util.Collection < com.google.gerrit.client.reviewdb.ProjectRight > > ( ) ; if ( e != null ) { loadRights ( r , e.getRights ( ) ) ; } loadRights ( r , com.google.gerrit.client.rpc.Common.getProjectCache ( ) . getWildcardRights ( ) ) ; return r ; }
Source:
public void patchSetObjectAndRefMissing ( ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Change c = insertChange ( ) ; com.google.gerrit.reviewdb.client.PatchSet ps = com.google.gerrit.testutil.TestChanges.newPatchSet ( c.currentPatchSetId ( ) , org.eclipse.jgit.lib.ObjectId.fromString ( "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef" ) , adminId ) ; db.patchSets ( ) . insert ( java.util.Collections.singleton ( ps ) ) ; assertProblems ( c , ( "Ref missing: " + ( ps.getId ( ) . toRefName ( ) ) ) , "Object missing: patch set 1: deadbeefdeadbeefdeadbeefdeadbeefdeadbeef" ) ; }

Target:
public void patchSetObjectAndRefMissing ( ) throws java.lang.Exception { java.lang.String rev = "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef" ; com.google.gerrit.server.project.ChangeControl ctl = insertChange ( ) ; com.google.gerrit.reviewdb.client.PatchSet ps = insertMissingPatchSet ( ctl , rev ) ; ctl = reload ( ctl ) ; assertProblems ( ctl , null , com.google.gerrit.acceptance.server.change.ConsistencyCheckerIT.problem ( ( "Ref missing: " + ( ps.getId ( ) . toRefName ( ) ) ) ) , com.google.gerrit.acceptance.server.change.ConsistencyCheckerIT.problem ( ( "Object missing: patch set 2:" + " deadbeefdeadbeefdeadbeefdeadbeefdeadbeef" ) ) ) ; }
Source:
private void assertProblems ( com.google.gerrit.reviewdb.client.Change c , java.lang.String ... expected ) { com.google.common.truth.Truth.assertThat ( com.google.common.collect.Lists.transform ( checker.check ( c ) . problems ( ) , new com.google.common.base.Function < com.google.gerrit.extensions.common.ProblemInfo , java.lang.String > ( ) { @ java.lang.Override public java.lang.String apply ( com.google.gerrit.extensions.common.ProblemInfo in ) { com.google.common.base.Preconditions.checkArgument ( ( ( in.status ) == null ) , ( "Status is not null: " + ( in.message ) ) ) ; return in.message ; } } ) ) . containsExactly ( ( ( java.lang.Object [ ] ) ( expected ) ) ) ; }

Target:
private void assertProblems ( com.google.gerrit.server.project.ChangeControl ctl , @ com.google.gerrit.common.Nullable com.google.gerrit.extensions.api.changes.FixInput fix , com.google.gerrit.extensions.common.ProblemInfo first , com.google.gerrit.extensions.common.ProblemInfo ... rest ) { java.util.List < com.google.gerrit.extensions.common.ProblemInfo > expected = new java.util.ArrayList ( ( 1 + ( rest.length ) ) ) ; expected.add ( first ) ; expected.addAll ( java.util.Arrays.asList ( rest ) ) ; com.google.common.truth.Truth.assertThat ( checker.check ( ctl , fix ) . problems ( ) ) . containsExactlyElementsIn ( expected ) . inOrder ( ) ; }
Source:
private void assertNoIncludes ( java.lang.String group ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.AccountGroup g = groupCache.get ( new com.google.gerrit.reviewdb.client.AccountGroup.NameKey ( group ) ) ; java.util.Iterator < com.google.gerrit.reviewdb.client.AccountGroupById > it = db.accountGroupById ( ) . byGroup ( g.getId ( ) ) . iterator ( ) ; org.junit.Assert.assertFalse ( it.hasNext ( ) ) ; }

Target:
private void assertNoIncludes ( java.lang.String group ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.AccountGroup g = groupCache.get ( new com.google.gerrit.reviewdb.client.AccountGroup.NameKey ( group ) ) ; java.util.Iterator < com.google.gerrit.reviewdb.client.AccountGroupById > it = db.accountGroupById ( ) . byGroup ( g.getId ( ) ) . iterator ( ) ; com.google.common.truth.Truth.assertThat ( it.hasNext ( ) ) . isFalse ( ) ; }
Source:
public void addRemoveMember ( ) throws java.lang.Exception { com.google.gerrit.acceptance.RestResponse r = PUT ( "/groups/Administrators/members/user" ) ; org.junit.Assert.assertEquals ( HttpStatus.SC_CREATED , r.getStatusCode ( ) ) ; com.google.gerrit.server.account.AccountInfo ai = newGson ( ) . fromJson ( r.getReader ( ) , com.google.gerrit.server.account.AccountInfo.class ) ; com.google.gerrit.acceptance.rest.account.AccountAssert.assertAccountInfo ( user , ai ) ; assertMembers ( "Administrators" , admin , user ) ; r.consume ( ) ; org.junit.Assert.assertEquals ( HttpStatus.SC_NO_CONTENT , DELETE ( "/groups/Administrators/members/user" ) ) ; assertMembers ( "Administrators" , admin ) ; }

Target:
public void addRemoveMember ( ) throws java.lang.Exception { com.google.gerrit.acceptance.RestResponse r = PUT ( "/groups/Administrators/members/user" ) ; org.junit.Assert.assertEquals ( HttpStatus.SC_CREATED , r.getStatusCode ( ) ) ; com.google.gerrit.extensions.common.AccountInfo ai = newGson ( ) . fromJson ( r.getReader ( ) , com.google.gerrit.extensions.common.AccountInfo.class ) ; com.google.gerrit.acceptance.rest.account.AccountAssert.assertAccountInfo ( user , ai ) ; assertMembers ( "Administrators" , admin , user ) ; r.consume ( ) ; org.junit.Assert.assertEquals ( HttpStatus.SC_NO_CONTENT , DELETE ( "/groups/Administrators/members/user" ) ) ; assertMembers ( "Administrators" , admin ) ; }
Source:
public java.util.Map < java.lang.String , java.util.List < com.google.gerrit.extensions.common.RobotCommentInfo > > apply ( com.google.gerrit.server.change.ChangeResource rsrc ) throws com.google.gerrit.extensions.restapi.AuthException , com.google.gwtorm.server.OrmException { com.google.gerrit.server.query.change.ChangeData cd = changeDataFactory.create ( db.get ( ) , rsrc.getControl ( ) ) ; return commentJson.get ( ) . setFillAccounts ( true ) . setFillPatchSet ( true ) . newRobotCommentFormatter ( ) . format ( commentsUtil.robotCommentsByChange ( cd.notes ( ) ) ) ; }

Target:
public java.util.Map < java.lang.String , java.util.List < com.google.gerrit.extensions.common.RobotCommentInfo > > apply ( com.google.gerrit.server.change.ChangeResource rsrc ) throws com.google.gerrit.extensions.restapi.AuthException , com.google.gwtorm.server.OrmException { com.google.gerrit.server.query.change.ChangeData cd = changeDataFactory.create ( db.get ( ) , rsrc.getNotes ( ) ) ; return commentJson.get ( ) . setFillAccounts ( true ) . setFillPatchSet ( true ) . newRobotCommentFormatter ( ) . format ( commentsUtil.robotCommentsByChange ( cd.notes ( ) ) ) ; }
Source:
public void configure ( ) { install ( dbInjector.getInstance ( com.google.gerrit.pgm.util.BatchProgramModule.class ) ) ; install ( com.google.gerrit.server.git.SearchingChangeCacheImpl.module ( ) ) ; com.google.gerrit.extensions.registration.DynamicSet.bind ( binder ( ) , com.google.gerrit.extensions.events.GitReferenceUpdatedListener.class ) . to ( com.google.gerrit.server.index.change.ReindexAfterUpdate.class ) ; install ( new com.google.gerrit.server.index.DummyIndexModule ( ) ) ; }

Target:
public void configure ( ) { install ( dbInjector.getInstance ( com.google.gerrit.pgm.util.BatchProgramModule.class ) ) ; install ( com.google.gerrit.server.git.SearchingChangeCacheImpl.module ( ) ) ; com.google.gerrit.extensions.registration.DynamicSet.bind ( binder ( ) , com.google.gerrit.extensions.events.GitReferenceUpdatedListener.class ) . to ( com.google.gerrit.server.index.change.ReindexAfterUpdate.class ) ; install ( new com.google.gerrit.server.index.DummyIndexModule ( ) ) ; factory ( ChangeResource.Factory.class ) ; }
Source:
static void closeDataSource ( ) { if ( ( com.google.gerrit.server.GerritServer.datasource ) != null ) { try { try { java.lang.Class.forName ( "com.mchange.v2.c3p0.DataSources" ) . getMethod ( "destroy" , javax.sql.DataSource.class ) . invoke ( null , com.google.gerrit.server.GerritServer.datasource ) ; } catch ( java.lang.Throwable bad ) { } } finally { com.google.gerrit.server.GerritServer.datasource = null ; } } if ( ( com.google.gerrit.server.GerritServer.cacheMgr ) != null ) { try { com.google.gerrit.server.GerritServer.cacheMgr.shutdown ( ) ; } catch ( java.lang.Throwable bad ) { } finally { com.google.gerrit.server.GerritServer.cacheMgr = null ; } } }

Target:
static void closeCacheManager ( ) { if ( ( com.google.gerrit.server.GerritServer.cacheMgr ) != null ) { try { com.google.gerrit.server.GerritServer.cacheMgr.shutdown ( ) ; } catch ( java.lang.Throwable bad ) { } finally { com.google.gerrit.server.GerritServer.cacheMgr = null ; } } }
Source:
public void testParsingYaml ( ) { java.lang.String yamlString = ( "inherited: true\n" + ( "owners:\n" + "- " ) ) + ( USER_C_EMAIL_COM ) ; java.util.Optional < com.vmware.gerrit.owners.common.OwnersConfig > config = getOwnersConfig ( yamlString ) ; org.junit.Assert.assertTrue ( config.isPresent ( ) ) ; org.junit.Assert.assertEquals ( 1 , config.get ( ) . getOwners ( ) . size ( ) ) ; org.junit.Assert.assertTrue ( config.get ( ) . getOwners ( ) . contains ( com.vmware.gerrit.owners.common.USER_C_EMAIL_COM ) ) ; }

Target:
public void testParsingYaml ( ) { java.lang.String yamlString = "inherited: true\nowners:\n- " + ( USER_C_EMAIL_COM ) ; java.util.Optional < com.vmware.gerrit.owners.common.OwnersConfig > config = getOwnersConfig ( yamlString ) ; org.junit.Assert.assertTrue ( config.isPresent ( ) ) ; org.junit.Assert.assertTrue ( config.get ( ) . isInherited ( ) ) ; org.junit.Assert.assertEquals ( 1 , config.get ( ) . getOwners ( ) . size ( ) ) ; org.junit.Assert.assertTrue ( config.get ( ) . getOwners ( ) . contains ( com.vmware.gerrit.owners.common.USER_C_EMAIL_COM ) ) ; }
Source:
protected void setUpEnvironment ( com.google.gerrit.rules.PrologEnvironment env ) { com.google.gerrit.common.data.LabelTypes labelTypes = new com.google.gerrit.common.data.LabelTypes ( java.util.Arrays.asList ( com.google.gerrit.server.project.Util.codeReview ( ) , com.google.gerrit.server.project.Util.verified ( ) ) ) ; com.google.gerrit.server.project.ChangeControl ctl = org.easymock.EasyMock.createMock ( com.google.gerrit.server.project.ChangeControl.class ) ; org.easymock.EasyMock.expect ( ctl.getLabelTypes ( ) ) . andStubReturn ( labelTypes ) ; org.easymock.EasyMock.replay ( ctl ) ; env.set ( StoredValues.CHANGE_CONTROL , ctl ) ; }

Target:
protected void setUpEnvironment ( com.google.gerrit.rules.PrologEnvironment env ) { com.google.gerrit.common.data.LabelTypes labelTypes = new com.google.gerrit.common.data.LabelTypes ( java.util.Arrays.asList ( com.google.gerrit.server.project.Util.codeReview ( ) , com.google.gerrit.server.project.Util.verified ( ) ) ) ; com.google.gerrit.server.query.change.ChangeData cd = org.easymock.EasyMock.createMock ( com.google.gerrit.server.query.change.ChangeData.class ) ; org.easymock.EasyMock.expect ( cd.getLabelTypes ( ) ) . andStubReturn ( labelTypes ) ; org.easymock.EasyMock.replay ( cd ) ; env.set ( StoredValues.CHANGE_DATA , cd ) ; }
Source:
private void initForwarding ( ) { setTcpipForwardingFilter ( new org.apache.sshd.common.ForwardingFilter ( ) { @ java.lang.Override public boolean canForwardAgent ( org.apache.sshd.common.Session session ) { return false ; } @ java.lang.Override public boolean canForwardX11 ( org.apache.sshd.common.Session session ) { return false ; } @ java.lang.Override public boolean canListen ( org.apache.sshd.common.SshdSocketAddress address , org.apache.sshd.common.Session session ) { return false ; } @ java.lang.Override public boolean canConnect ( org.apache.sshd.common.SshdSocketAddress address , org.apache.sshd.common.Session session ) { return false ; } } ) ; setTcpipForwarderFactory ( new org.apache.sshd.common.forward.DefaultTcpipForwarderFactory ( ) ) ; }

Target:
private void initForwarding ( ) { setTcpipForwardingFilter ( new org.apache.sshd.server.forward.ForwardingFilter ( ) { @ java.lang.Override public boolean canForwardAgent ( org.apache.sshd.common.session.Session session ) { return false ; } @ java.lang.Override public boolean canForwardX11 ( org.apache.sshd.common.session.Session session ) { return false ; } @ java.lang.Override public boolean canListen ( org.apache.sshd.common.util.net.SshdSocketAddress address , org.apache.sshd.common.session.Session session ) { return false ; } @ java.lang.Override public boolean canConnect ( com.google.gerrit.sshd.Type type , org.apache.sshd.common.util.net.SshdSocketAddress address , org.apache.sshd.common.session.Session session ) { return false ; } } ) ; setTcpipForwarderFactory ( new org.apache.sshd.common.forward.DefaultTcpipForwarderFactory ( ) ) ; }
Source:
private java.lang.String getCommand ( java.lang.String command , com.google.gitiles.RevisionParser.Result result , java.lang.String path ) { if ( ! ( com.google.gitiles.ViewFilter.CMD_AUTO.equals ( command ) ) ) { return command ; } else if ( ( result.getOldRevision ( ) ) != null ) { return com.google.gitiles.ViewFilter.CMD_DIFF ; } else { return com.google.gitiles.ViewFilter.CMD_SHOW ; } }

Target:
private RevisionParser.Result parseRevision ( javax.servlet.http.HttpServletRequest req , java.lang.String path ) throws java.io.IOException { com.google.gitiles.RevisionParser revParser = new com.google.gitiles.RevisionParser ( org.eclipse.jgit.http.server.ServletUtils.getRepository ( req ) , accessFactory.forRequest ( req ) , visibilityCache ) ; return revParser.parse ( com.google.gitiles.ViewFilter.checkLeadingSlash ( path ) ) ; }
Source:
public void testCannotUploadToAnyRef ( ) { grant ( parent , com.google.gerrit.common.data.Permission.READ , registered , "refs/*" ) ; grant ( local , com.google.gerrit.common.data.Permission.READ , devs , "refs/heads/*" ) ; grant ( local , com.google.gerrit.common.data.Permission.PUSH , devs , "refs/for/refs/heads/*" ) ; com.google.gerrit.server.project.ProjectControl u = user ( ) ; assertFalse ( "cannot upload" , u.canPushToAtLeastOneRef ( ) ) ; assertFalse ( "cannot upload refs/heads/master" , u.controlForRef ( "refs/heads/master" ) . canUpload ( ) ) ; }

Target:
public void testCannotUploadToAnyRef ( ) { grant ( parent , com.google.gerrit.common.data.Permission.READ , registered , "refs/*" ) ; grant ( local , com.google.gerrit.common.data.Permission.READ , devs , "refs/heads/*" ) ; grant ( local , com.google.gerrit.common.data.Permission.PUSH , devs , "refs/for/refs/heads/*" ) ; com.google.gerrit.server.project.ProjectControl u = user ( ) ; assertFalse ( "cannot upload" , ( ( u.canPushToAtLeastOneRef ( ) ) == ( com.google.gerrit.common.data.Capable.OK ) ) ) ; assertFalse ( "cannot upload refs/heads/master" , u.controlForRef ( "refs/heads/master" ) . canUpload ( ) ) ; }
Source:
public void testLimit ( ) throws java.lang.Exception { com.google.gerrit.server.query.Predicate < com.google.gerrit.server.query.change.ChangeData > in = parse ( "file:a limit:3" ) ; com.google.gerrit.server.query.Predicate < com.google.gerrit.server.query.change.ChangeData > out = rewrite ( in ) ; org.junit.Assert.assertSame ( com.google.gerrit.server.query.change.AndSource.class , out.getClass ( ) ) ; org.junit.Assert.assertEquals ( com.google.common.collect.ImmutableList.of ( query ( in.getChild ( 0 ) , 3 ) , in.getChild ( 1 ) ) , out.getChildren ( ) ) ; }

Target:
public void testLimitArgumentOverridesAllLimitPredicates ( ) throws java.lang.Exception { com.google.gerrit.server.query.Predicate < com.google.gerrit.server.query.change.ChangeData > in = parse ( "limit:1 file:a limit:3" ) ; com.google.gerrit.server.query.Predicate < com.google.gerrit.server.query.change.ChangeData > out = rewrite ( in , 5 ) ; org.junit.Assert.assertSame ( com.google.gerrit.server.query.change.AndSource.class , out.getClass ( ) ) ; org.junit.Assert.assertEquals ( com.google.common.collect.ImmutableList.of ( query ( in.getChild ( 1 ) , 5 ) , parse ( "limit:5" ) , parse ( "limit:5" ) ) , out.getChildren ( ) ) ; }
Source:
private java.util.Map < com.google.gerrit.reviewdb.client.PatchSet.Id , com.google.gerrit.reviewdb.client.PatchSet > filterPatchSets ( ) { final int max = change.currentPatchSetId ( ) . get ( ) ; return com.google.common.collect.Maps.filterKeys ( patchSets , new com.google.common.base.Predicate < com.google.gerrit.reviewdb.client.PatchSet.Id > ( ) { @ java.lang.Override public boolean apply ( com.google.gerrit.reviewdb.client.PatchSet.Id in ) { return ( in.get ( ) ) <= max ; } } ) ; }

Target:
private java.util.Map < com.google.gerrit.reviewdb.client.PatchSet.Id , com.google.gerrit.reviewdb.client.PatchSet > filterPatchSets ( ) { return com.google.common.collect.Maps.filterKeys ( patchSets , upToCurrentPredicate ( ) ) ; }
Source:
protected void selectProtocol ( com.google.gerrit.acceptance.git.AbstractPushForReview.Protocol p ) throws java.io.IOException , org.eclipse.jgit.api.errors.GitAPIException { java.lang.String url ; switch ( p ) { case SSH : url = sshUrl ; break ; case HTTP : url = admin.getHttpUrl ( server ) ; break ; default : throw new java.lang.IllegalArgumentException ( ( "unexpected protocol: " + p ) ) ; } git = com.google.gerrit.acceptance.git.GitUtil.cloneProject ( ( ( url + "/" ) + ( project.get ( ) ) ) ) ; }

Target:
protected void selectProtocol ( com.google.gerrit.acceptance.git.AbstractPushForReview.Protocol p ) throws java.io.IOException , org.eclipse.jgit.api.errors.GitAPIException { java.lang.String url ; switch ( p ) { case SSH : url = sshUrl ; break ; case HTTP : url = admin.getHttpUrl ( server ) ; break ; default : throw new java.lang.IllegalArgumentException ( ( "unexpected protocol: " + p ) ) ; } git = com.google.gerrit.acceptance.GitUtil.cloneProject ( ( ( url + "/" ) + ( project.get ( ) ) ) ) ; }
Source:
private PushOneCommit.Result push ( java.lang.String ref , java.lang.String subject , java.lang.String fileName , java.lang.String content , java.lang.String changeId ) throws java.io.IOException , org.eclipse.jgit.api.errors.GitAPIException { com.google.gerrit.acceptance.PushOneCommit push = pushFactory.create ( db , admin.getIdent ( ) , git , subject , fileName , content , changeId ) ; return push.to ( ref ) ; }

Target:
private PushOneCommit.Result push ( java.lang.String ref , java.lang.String subject , java.lang.String fileName , java.lang.String content , java.lang.String changeId ) throws java.lang.Exception { com.google.gerrit.acceptance.PushOneCommit push = pushFactory.create ( db , admin.getIdent ( ) , testRepo , subject , fileName , content , changeId ) ; return push.to ( ref ) ; }