auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private com.google.gerrit.httpd.resources.Resource getMarkdownAsHtmlResource ( com.googlesource.gerrit.plugins.xdocs.XDocGlobalConfig cfg , com.google.gerrit.reviewdb.client.Project.NameKey project , java.lang.String md , int lastModified ) throws java.io.IOException { com.google.gerrit.server.documentation.MarkdownFormatter f = new com.google.gerrit.server.documentation.MarkdownFormatter ( ) ; if ( ! ( cfg.isHtmlAllowed ( Formatter.MARKDOWN ) ) ) { f.suppressHtml ( ) ; } byte [ ] html = f.markdownToDocHtml ( replaceMacros ( project , md ) , java.nio.charset.StandardCharsets.UTF_8.name ( ) ) ; return new com.google.gerrit.httpd.resources.SmallResource ( html ) . setContentType ( "text/html" ) . setCharacterEncoding ( java.nio.charset.StandardCharsets.UTF_8.name ( ) ) . setLastModified ( lastModified ) ; }

Target:
private byte [ ] formatAsHtml ( com.googlesource.gerrit.plugins.xdocs.XDocGlobalConfig cfg , com.googlesource.gerrit.plugins.xdocs.XDocGlobalConfig.Formatter formatter , java.lang.String raw ) throws java.io.IOException { switch ( formatter ) { case MARKDOWN : return formatMarkdownAsHtml ( cfg , raw ) ; default : throw new java.lang.IllegalStateException ( ( "Unsupported formatter: " + ( formatter.name ( ) ) ) ) ; } }
Source:
public static void createGroup ( java.lang.String groupName , com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.groups.GroupInfo > cb ) { java.lang.String n = com.google.gwt.http.client.URL.encodePathSegment ( groupName ) ; new com.google.gerrit.client.rpc.RestApi ( ( "/groups/" + n ) ) . ifNoneMatch ( ) . put ( cb ) ; }

Target:
public static void createGroup ( java.lang.String groupName , com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.groups.GroupInfo > cb ) { com.google.gwt.core.client.JavaScriptObject in = com.google.gwt.core.client.JavaScriptObject.createObject ( ) ; java.lang.String n = com.google.gwt.http.client.URL.encodePathSegment ( groupName ) ; new com.google.gerrit.client.rpc.RestApi ( ( "/groups/" + n ) ) . ifNoneMatch ( ) . data ( in ) . put ( cb ) ; }
Source:
private com.google.inject.Injector createSshInjector ( ) { final java.util.List < com.google.inject.Module > modules = new java.util.ArrayList < > ( ) ; modules.add ( sysInjector.getInstance ( com.google.gerrit.sshd.SshModule.class ) ) ; modules.add ( new com.google.gerrit.sshd.SshHostKeyModule ( ) ) ; modules.add ( new com.google.gerrit.sshd.commands.DefaultCommandModule ( false ) ) ; return sysInjector.createChildInjector ( modules ) ; }

Target:
private com.google.inject.Injector createSshInjector ( ) { final java.util.List < com.google.inject.Module > modules = new java.util.ArrayList < > ( ) ; modules.add ( sysInjector.getInstance ( com.google.gerrit.sshd.SshModule.class ) ) ; modules.add ( new com.google.gerrit.sshd.SshHostKeyModule ( ) ) ; modules.add ( new com.google.gerrit.sshd.commands.DefaultCommandModule ( false , sysInjector.getInstance ( com.google.gerrit.server.config.DownloadConfig.class ) ) ) ; return sysInjector.createChildInjector ( modules ) ; }
Source:
public void testEvictAccountsOK ( ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Account.Id key = Account.Id.parse ( "123" ) ; java.lang.String keyJson = new com.google.gson.GsonBuilder ( ) . create ( ) . toJson ( key ) ; org.mockito.Mockito.when ( httpSessionMock.post ( buildCacheEndpoint ( Constants.ACCOUNTS ) , keyJson ) ) . thenReturn ( new com.ericsson.gerrit.plugins.highavailability.forwarder.rest.HttpResponseHandler.HttpResult ( com.ericsson.gerrit.plugins.highavailability.forwarder.rest.RestForwarderTest.SUCCESSFUL , com.ericsson.gerrit.plugins.highavailability.forwarder.rest.RestForwarderTest.EMPTY_MSG ) ) ; com.google.common.truth.Truth.assertThat ( forwarder.evict ( Constants.ACCOUNTS , key ) ) . isTrue ( ) ; }

Target:
public void testEvictAccountsOK ( ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Account.Id key = Account.Id.tryParse ( "123" ) . get ( ) ; java.lang.String keyJson = new com.google.gson.GsonBuilder ( ) . create ( ) . toJson ( key ) ; org.mockito.Mockito.when ( httpSessionMock.post ( buildCacheEndpoint ( Constants.ACCOUNTS ) , keyJson ) ) . thenReturn ( new com.ericsson.gerrit.plugins.highavailability.forwarder.rest.HttpResponseHandler.HttpResult ( com.ericsson.gerrit.plugins.highavailability.forwarder.rest.RestForwarderTest.SUCCESSFUL , com.ericsson.gerrit.plugins.highavailability.forwarder.rest.RestForwarderTest.EMPTY_MSG ) ) ; com.google.common.truth.Truth.assertThat ( forwarder.evict ( Constants.ACCOUNTS , key ) ) . isTrue ( ) ; }
Source:
public void onSuccess ( java.lang.Void result ) { goUpToChange ( openReplyBox ) ; }

Target:
public void onSuccess ( java.lang.Void result ) { java.lang.String b = ( ( base ) != null ) ? java.lang.String.valueOf ( base.get ( ) ) : null ; java.lang.String rev = java.lang.String.valueOf ( revision.get ( ) ) ; com.google.gerrit.client.Gerrit.display ( com.google.gerrit.common.PageLinks.toChange ( changeId , rev ) , new com.google.gerrit.client.change.ChangeScreen2 ( changeId , b , rev , openReplyBox ) ) ; }
Source:
public void onSuccess ( final com.google.gerrit.common.data.HostPageData result ) { com.google.gwt.dom.client.Document.get ( ) . getElementById ( "gerrit_hostpagedata" ) . removeFromParent ( ) ; com.google.gerrit.client.Gerrit.myConfig = result.config ; com.google.gerrit.client.Gerrit.myTheme = result.theme ; com.google.gerrit.client.Gerrit.isNoteDbEnabled = result.isNoteDbEnabled ; if ( ( result.account ) != null ) { com.google.gerrit.client.Gerrit.myAccount = result.account ; com.google.gerrit.client.Gerrit.xGerritAuth = result.xGerritAuth ; } if ( ( result.accountDiffPref ) != null ) { com.google.gerrit.client.Gerrit.myAccountDiffPref = result.accountDiffPref ; com.google.gerrit.client.Gerrit.applyUserPreferences ( ) ; } onModuleLoad2 ( result ) ; }

Target:
public void onSuccess ( com.google.gerrit.client.info.AccountInfo result ) { com.google.gerrit.client.Gerrit.myAccount = result ; }
Source:
void onReviewMode ( @ java.lang.SuppressWarnings ( value = "unused" ) com.google.gwt.event.dom.client.ClickEvent e ) { fileTableMode = FileTable.Mode.REVIEW ; refreshFileTable ( ) ; editMode.setVisible ( true ) ; addFile.setVisible ( false ) ; deleteFile.setVisible ( false ) ; reviewMode.setVisible ( false ) ; }

Target:
void onReviewMode ( @ java.lang.SuppressWarnings ( value = "unused" ) com.google.gwt.event.dom.client.ClickEvent e ) { fileTableMode = FileTable.Mode.REVIEW ; refreshFileTable ( ) ; editMode.setVisible ( true ) ; addFile.setVisible ( false ) ; deleteFile.setVisible ( false ) ; renameFile.setVisible ( false ) ; reviewMode.setVisible ( false ) ; }
Source:
public void testIsEnabledRefParentNoBranchDisabled ( ) { java.lang.String [ ] branches = new java.lang.String [ ] { } ; setupIsEnabled ( "false" , "false" , branches ) ; com.googlesource.gerrit.plugins.its.base.its.ItsConfig itsConfig = createItsConfig ( ) ; replayMocks ( ) ; assertFalse ( itsConfig.isEnabled ( "testProject" , "refs/heads/testBranch" ) ) ; }

Target:
public void testIsEnabledRefParentNoBranchDisabled ( ) { java.lang.String [ ] branches = new java.lang.String [ ] { } ; setupIsEnabled ( "false" , "false" , branches ) ; com.googlesource.gerrit.plugins.its.base.its.ItsConfig itsConfig = createItsConfig ( ) ; replayMocks ( ) ; com.google.gerrit.reviewdb.client.Project.NameKey projectNK = new com.google.gerrit.reviewdb.client.Project.NameKey ( "testProject" ) ; assertFalse ( itsConfig.isEnabled ( projectNK , "refs/heads/testBranch" ) ) ; }
Source:
public void defaultSubmitTypeForSpecificFilter ( ) { configureDefaultSubmitType ( "someProject" , SubmitType.CHERRY_PICK ) ; com.google.common.truth.Truth.assertThat ( repoCfg.getDefaultSubmitType ( new com.google.gerrit.reviewdb.client.Project.NameKey ( "someOtherProject" ) ) ) . isEqualTo ( SubmitType.MERGE_IF_NECESSARY ) ; com.google.common.truth.Truth.assertThat ( repoCfg.getDefaultSubmitType ( new com.google.gerrit.reviewdb.client.Project.NameKey ( "someProject" ) ) ) . isEqualTo ( SubmitType.CHERRY_PICK ) ; }

Target:
public void defaultSubmitTypeForSpecificFilter ( ) { configureDefaultSubmitType ( "someProject" , SubmitType.CHERRY_PICK ) ; com.google.common.truth.Truth.assertThat ( repoCfg.getDefaultSubmitType ( new com.google.gerrit.reviewdb.client.Project.NameKey ( "someOtherProject" ) ) ) . isEqualTo ( RepositoryConfig.DEFAULT_SUBMIT_TYPE ) ; com.google.common.truth.Truth.assertThat ( repoCfg.getDefaultSubmitType ( new com.google.gerrit.reviewdb.client.Project.NameKey ( "someProject" ) ) ) . isEqualTo ( SubmitType.CHERRY_PICK ) ; }
Source:
private void tearDown ( ) { if ( ( lifecycle ) != null ) { lifecycle.stop ( ) ; } if ( ( requestContext ) != null ) { requestContext.setContext ( null ) ; } if ( ( db ) != null ) { db.close ( ) ; } com.google.gerrit.testutil.InMemoryDatabase.drop ( inMemoryDatabase ) ; }

Target:
private void tearDown ( ) { if ( ( lifecycle ) != null ) { lifecycle.stop ( ) ; } if ( ( requestContext ) != null ) { requestContext.setContext ( null ) ; } if ( ( db ) != null ) { db.close ( ) ; } com.google.gerrit.testing.InMemoryDatabase.drop ( inMemoryDatabase ) ; }
Source:
private static boolean isMetadata ( com.google.gerrit.server.project.ProjectControl projectCtl , java.lang.String name ) { return ( ( name.startsWith ( com.google.gerrit.reviewdb.client.RefNames.REFS_CHANGES ) ) || ( com.google.gerrit.reviewdb.client.RefNames.isRefsEdit ( name ) ) ) || ( ( projectCtl.getProjectState ( ) . isAllUsers ( ) ) && ( name.equals ( RefNames.REFS_EXTERNAL_IDS ) ) ) ; }

Target:
private boolean isMetadata ( java.lang.String name ) { return ( ( name.startsWith ( com.google.gerrit.reviewdb.client.RefNames.REFS_CHANGES ) ) || ( com.google.gerrit.reviewdb.client.RefNames.isRefsEdit ( name ) ) ) || ( ( projectState.isAllUsers ( ) ) && ( name.equals ( RefNames.REFS_EXTERNAL_IDS ) ) ) ; }
Source:
public int compare ( com.google.gerrit.client.groups.GroupInfo a , com.google.gerrit.client.groups.GroupInfo b ) { int cmp = nullToEmpty ( a.name ( ) ) . compareTo ( nullToEmpty ( b.name ( ) ) ) ; if ( cmp != 0 ) { return cmp ; } return a.getGroupUUID ( ) . compareTo ( b.getGroupUUID ( ) ) ; }

Target:
public int compare ( com.google.gerrit.client.info.GroupInfo a , com.google.gerrit.client.info.GroupInfo b ) { int cmp = nullToEmpty ( a.name ( ) ) . compareTo ( nullToEmpty ( b.name ( ) ) ) ; if ( cmp != 0 ) { return cmp ; } return a.getGroupUUID ( ) . compareTo ( b.getGroupUUID ( ) ) ; }
Source:
public static void getContent ( com.google.gerrit.reviewdb.client.PatchSet.Id id , java.lang.String filename , com.google.gwt.user.client.rpc.AsyncCallback < java.lang.String > cb ) { com.google.gerrit.client.changes.ChangeFileApi.contentEditOrPs ( id , filename ) . get ( new com.google.gerrit.client.changes.ChangeFileApi.CallbackWrapper < com.google.gerrit.client.rpc.NativeString , java.lang.String > ( cb ) { @ java.lang.Override public void onSuccess ( com.google.gerrit.client.rpc.NativeString b64 ) { if ( b64 != null ) { wrapped.onSuccess ( com.google.gerrit.client.changes.ChangeFileApi.b64decode ( b64.asString ( ) ) ) ; } } } ) ; }

Target:
public static void getContent ( com.google.gerrit.reviewdb.client.PatchSet.Id id , java.lang.String filename , com.google.gwt.user.client.rpc.AsyncCallback < java.lang.String > cb ) { com.google.gerrit.client.changes.ChangeFileApi.contentEditOrPs ( id , filename ) . get ( com.google.gerrit.client.changes.ChangeFileApi.wrapper ( cb ) ) ; }
Source:
public static java.lang.String format ( final java.net.SocketAddress s , final int defaultPort ) { if ( s instanceof java.net.InetSocketAddress ) { final java.net.InetSocketAddress addr = ( ( java.net.InetSocketAddress ) ( s ) ) ; return com.google.gerrit.server.util.SocketUtil.format ( com.google.gerrit.server.util.SocketUtil.hostname ( addr ) , addr.getPort ( ) ) ; } return s.toString ( ) ; }

Target:
public static java.lang.String format ( final java.net.SocketAddress s , final int defaultPort ) { if ( s instanceof java.net.InetSocketAddress ) { final java.net.InetSocketAddress addr = ( ( java.net.InetSocketAddress ) ( s ) ) ; if ( ( addr.getPort ( ) ) == defaultPort ) { return com.google.gerrit.server.util.SocketUtil.safeHostname ( com.google.gerrit.server.util.SocketUtil.hostname ( addr ) ) ; } return com.google.gerrit.server.util.SocketUtil.format ( com.google.gerrit.server.util.SocketUtil.hostname ( addr ) , addr.getPort ( ) ) ; } return s.toString ( ) ; }
Source:
public void commentOnWipChangeByOwnerCcingSelf ( ) throws java.lang.Exception { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageWipChange ( com.google.gerrit.server.account.WatchConfig.NotifyType.ALL_COMMENTS ) ; review ( sc.owner , sc.changeId , com.google.gerrit.extensions.client.GeneralPreferencesInfo.EmailStrategy.CC_ON_OWN_COMMENTS ) ; assertThat ( sender ) . notSent ( ) ; }

Target:
public void commentOnWipChangeByOwnerNotifyAll ( ) throws java.lang.Exception { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageWipChange ( ) ; review ( sc.owner , sc.changeId , com.google.gerrit.extensions.client.GeneralPreferencesInfo.EmailStrategy.ENABLED , com.google.gerrit.extensions.api.changes.NotifyHandling.ALL ) ; assertThat ( sender ) . sent ( "comment" , sc ) . cc ( sc.reviewer , sc.ccer ) . cc ( sc.reviewerByEmail , sc.ccerByEmail ) . bcc ( sc.starrer ) . bcc ( com.google.gerrit.server.account.WatchConfig.NotifyType.ALL_COMMENTS ) . noOneElse ( ) ; }
Source:
java.lang.Runnable maybePrevVimSearch ( final net.codemirror.lib.CodeMirror cm ) { return new java.lang.Runnable ( ) { @ java.lang.Override public void run ( ) { if ( cm.vim ( ) . hasSearchHighlight ( ) ) { cm.vim ( ) . handleKey ( "n" ) ; } else { getCommentManager ( ) . commentNav ( cm , Direction.NEXT ) . run ( ) ; } } } ; }

Target:
private java.lang.Runnable maybeNextVimSearch ( final net.codemirror.lib.CodeMirror cm ) { return new java.lang.Runnable ( ) { @ java.lang.Override public void run ( ) { if ( cm.vim ( ) . hasSearchHighlight ( ) ) { cm.vim ( ) . handleKey ( "n" ) ; } else { getChunkManager ( ) . diffChunkNav ( cm , Direction.NEXT ) . run ( ) ; } } } ; }
Source:
public java.lang.String getETag ( ) { com.google.gerrit.server.CurrentUser user = control.getUser ( ) ; com.google.common.hash.Hasher h = com.google.common.hash.Hashing.md5 ( ) . newHasher ( ) . putBoolean ( user.getStarredChanges ( ) . contains ( getId ( ) ) ) ; prepareETag ( h , user ) ; return h.hash ( ) . toString ( ) ; }

Target:
public java.lang.String getETag ( ) { com.google.gerrit.server.CurrentUser user = control.getUser ( ) ; com.google.common.hash.Hasher h = com.google.common.hash.Hashing.md5 ( ) . newHasher ( ) ; h.putString ( starredChangesUtil.getObjectId ( user.getAccountId ( ) , getId ( ) ) . name ( ) , java.nio.charset.StandardCharsets.UTF_8 ) ; prepareETag ( h , user ) ; return h.hash ( ) . toString ( ) ; }
Source:
public java.lang.String toString ( ) { java.util.List < com.google.gerrit.server.account.WatchConfig.NotifyType > notifyTypes = new java.util.ArrayList < > ( notifyTypes ( ) ) ; java.lang.StringBuilder notifyValue = new java.lang.StringBuilder ( ) ; notifyValue.append ( com.google.common.base.MoreObjects.firstNonNull ( filter ( ) , com.google.gerrit.server.account.WatchConfig.FILTER_ALL ) ) . append ( " [" ) ; com.google.common.base.Joiner.on ( ", " ) . appendTo ( notifyValue , notifyTypes ) ; notifyValue.append ( "]" ) ; return notifyValue.toString ( ) ; }

Target:
public java.lang.String toString ( ) { java.util.List < com.google.gerrit.server.account.ProjectWatches.NotifyType > notifyTypes = new java.util.ArrayList < > ( notifyTypes ( ) ) ; java.lang.StringBuilder notifyValue = new java.lang.StringBuilder ( ) ; notifyValue.append ( com.google.common.base.MoreObjects.firstNonNull ( filter ( ) , com.google.gerrit.server.account.ProjectWatches.FILTER_ALL ) ) . append ( " [" ) ; com.google.common.base.Joiner.on ( ", " ) . appendTo ( notifyValue , notifyTypes ) ; notifyValue.append ( "]" ) ; return notifyValue.toString ( ) ; }
Source:
private java.io.InputStream openRobotsFile ( ) { if ( ( robotsFile ) != null ) { try { return new java.io.FileInputStream ( robotsFile ) ; } catch ( java.io.IOException e ) { com.google.gerrit.httpd.raw.RobotsServlet.log.warn ( ( ( "Cannot read " + ( robotsFile ) ) + "; using default" ) , e ) ; } } return getServletContext ( ) . getResourceAsStream ( "/robots.txt" ) ; }

Target:
private java.io.InputStream openRobotsFile ( ) { if ( ( robotsFile ) != null ) { try { return java.nio.file.Files.newInputStream ( robotsFile ) ; } catch ( java.io.IOException e ) { com.google.gerrit.httpd.raw.RobotsServlet.log.warn ( ( ( "Cannot read " + ( robotsFile ) ) + "; using default" ) , e ) ; } } return getServletContext ( ) . getResourceAsStream ( "/robots.txt" ) ; }
Source:
void flush ( ) throws java.io.IOException { com.google.common.base.Preconditions.checkState ( ( ( finalIns ) != null ) ) ; for ( com.google.gerrit.server.git.InsertedObject obj : tempIns.getInsertedObjects ( ) ) { finalIns.insert ( obj.type ( ) , obj.data ( ) . toByteArray ( ) ) ; } finalIns.flush ( ) ; tempIns.clear ( ) ; }

Target:
void flush ( ) throws java.io.IOException { flushToFinalInserter ( ) ; finalIns.flush ( ) ; tempIns.clear ( ) ; }
Source:
public void start ( ) { queue.start ( ) ; if ( ( ( srvInfo.getState ( ) ) == ( ServerInformation.State.STARTUP ) ) && ( config.isReplicateAllOnPluginStart ( ) ) ) { com.googlesource.gerrit.plugins.replication.ReplicationState state = new com.googlesource.gerrit.plugins.replication.ReplicationState ( ) ; pushAllFuture.set ( pushAll.create ( null , com.googlesource.gerrit.plugins.replication.ReplicationFilter.all ( ) , state ) . schedule ( 30 , java.util.concurrent.TimeUnit.SECONDS ) ) ; } }

Target:
public void start ( ) { queue.start ( ) ; if ( ( ( srvInfo.getState ( ) ) == ( ServerInformation.State.STARTUP ) ) && ( config.isReplicateAllOnPluginStart ( ) ) ) { com.googlesource.gerrit.plugins.replication.ReplicationState state = new com.googlesource.gerrit.plugins.replication.ReplicationState ( new com.googlesource.gerrit.plugins.replication.PushResultProcessing.GitUpdateProcessing ( eventDispatcher , database ) ) ; pushAllFuture.set ( pushAll.create ( null , com.googlesource.gerrit.plugins.replication.ReplicationFilter.all ( ) , state ) . schedule ( 30 , java.util.concurrent.TimeUnit.SECONDS ) ) ; } }
Source:
private PushOneCommit.Result createChangeWithTopic ( ) throws java.io.IOException , org.eclipse.jgit.api.errors.GitAPIException { com.google.gerrit.acceptance.PushOneCommit push = pushFactory.create ( db , admin.getIdent ( ) ) ; return push.to ( git , "refs/for/master%topic=foo" ) ; }

Target:
private PushOneCommit.Result createChangeWithTopic ( java.lang.String topic ) throws java.io.IOException , org.eclipse.jgit.api.errors.GitAPIException { com.google.gerrit.acceptance.PushOneCommit push = pushFactory.create ( db , admin.getIdent ( ) ) ; com.google.common.truth.Truth.assertThat ( topic ) . isNotEmpty ( ) ; return push.to ( git , ( "refs/for/master/" + topic ) ) ; }
Source:
private org.apache.lucene.search.Query exactQuery ( com.google.gerrit.server.index.IndexPredicate < com.google.gerrit.server.query.change.ChangeData > p ) { return new org.apache.lucene.search.TermQuery ( new org.apache.lucene.index.Term ( p.getOperator ( ) , p.getValue ( ) ) ) ; }

Target:
private org.apache.lucene.search.Query exactQuery ( com.google.gerrit.server.index.IndexPredicate < com.google.gerrit.server.query.change.ChangeData > p ) { if ( p instanceof com.google.gerrit.server.index.RegexPredicate < ? > ) { return regexQuery ( p ) ; } else { return new org.apache.lucene.search.TermQuery ( new org.apache.lucene.index.Term ( p.getOperator ( ) , p.getValue ( ) ) ) ; } }
Source:
public java.io.InputStream getInputStream ( ) throws java.io.IOException { return new java.io.ByteArrayInputStream ( sshKey.getBytes ( java.nio.charset.StandardCharsets.UTF_8 ) ) ; }

Target:
private void addSshKeys ( java.util.List < java.lang.String > sshKeys ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gwtorm.server.OrmException , java.io.IOException { for ( final java.lang.String sshKey : sshKeys ) { com.google.gerrit.server.account.AddSshKey.Input in = new com.google.gerrit.server.account.AddSshKey.Input ( ) ; in.raw = com.google.gerrit.common.RawInputUtil.create ( sshKey.getBytes ( ) , "plain/text" ) ; addSshKey.apply ( rsrc , in ) ; } }
Source:
private void saveChange ( com.google.gerrit.server.git.BatchUpdate.ChangeContext ctx ) { change = ctx.getChange ( ) ; com.google.gerrit.server.notedb.ChangeUpdate update = ctx.getUpdate ( psId ) ; wasDraftChange = ( change.getStatus ( ) ) == ( Change.Status.DRAFT ) ; if ( wasDraftChange ) { change.setStatus ( Change.Status.NEW ) ; update.setStatus ( change.getStatus ( ) ) ; } }

Target:
private void saveChange ( com.google.gerrit.server.update.BatchUpdate.ChangeContext ctx ) { change = ctx.getChange ( ) ; com.google.gerrit.server.notedb.ChangeUpdate update = ctx.getUpdate ( psId ) ; wasDraftChange = ( change.getStatus ( ) ) == ( Change.Status.DRAFT ) ; if ( wasDraftChange ) { change.setStatus ( Change.Status.NEW ) ; update.setStatus ( change.getStatus ( ) ) ; } }
Source:
public void testIsEnabledRefParentNoBranchDisabled ( ) { java.lang.String [ ] branches = new java.lang.String [ ] { } ; setupIsEnabled ( "false" , "false" , branches ) ; com.googlesource.gerrit.plugins.its.base.its.ItsConfig itsConfig = createItsConfig ( ) ; replayMocks ( ) ; assertFalse ( itsConfig.isEnabled ( "testProject" , "refs/heads/testBranch" ) ) ; }

Target:
public void testIsEnabledRefNoParentMatchingBranchMiddleEnforced ( ) { java.lang.String [ ] branches = new java.lang.String [ ] { "^refs/heads/foo.*" , "^refs/heads/test.*" , "^refs/heads/baz.*" } ; setupIsEnabled ( "enforced" , null , branches ) ; com.googlesource.gerrit.plugins.its.base.its.ItsConfig itsConfig = createItsConfig ( ) ; replayMocks ( ) ; com.google.gerrit.reviewdb.client.Project.NameKey projectNK = new com.google.gerrit.reviewdb.client.Project.NameKey ( "testProject" ) ; assertTrue ( itsConfig.isEnabled ( projectNK , "refs/heads/testBranch" ) ) ; }
Source:
public void setUp ( ) throws java.lang.Exception { normalProject = createProject ( "normal" ) ; secretProject = createProject ( "secret" ) ; secretRefProject = createProject ( "secretRef" ) ; privilegedGroup = group ( createGroup ( "privilegedGroup" ) ) ; privilegedUser = accountCreator.create ( "privilegedUser" , "snowden@nsa.gov" , "Ed Snowden" ) ; gApi.groups ( ) . id ( privilegedGroup.getGroupUUID ( ) . get ( ) ) . addMembers ( privilegedUser.username ) ; com.google.common.truth.Truth.assertThat ( gApi.groups ( ) . id ( privilegedGroup.getGroupUUID ( ) . get ( ) ) . members ( ) . get ( 0 ) . email ) . contains ( "snowden" ) ; grant ( secretProject , "refs/*" , Permission.READ , false , privilegedGroup.getGroupUUID ( ) ) ; block ( secretProject , "refs/*" , Permission.READ , SystemGroupBackend.REGISTERED_USERS ) ; deny ( secretRefProject , "refs/*" , Permission.READ , SystemGroupBackend.ANONYMOUS_USERS ) ; grant ( secretRefProject , "refs/heads/secret/*" , Permission.READ , false , privilegedGroup.getGroupUUID ( ) ) ; block ( secretRefProject , "refs/heads/secret/*" , Permission.READ , SystemGroupBackend.REGISTERED_USERS ) ; grant ( secretRefProject , "refs/heads/*" , Permission.READ , false , SystemGroupBackend.REGISTERED_USERS ) ; com.google.gerrit.server.git.ProjectConfig cfg = projectCache.checkedGet ( project ) . getConfig ( ) ; grant ( normalProject , "refs/*" , Permission.VIEW_PRIVATE_CHANGES , false , privilegedGroup.getGroupUUID ( ) ) ; grant ( normalProject , "refs/*" , Permission.FORGE_SERVER , false , privilegedGroup.getGroupUUID ( ) ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { normalProject = createProject ( "normal" ) ; secretProject = createProject ( "secret" ) ; secretRefProject = createProject ( "secretRef" ) ; privilegedGroup = group ( createGroup ( "privilegedGroup" ) ) ; privilegedUser = accountCreator.create ( "privilegedUser" , "snowden@nsa.gov" , "Ed Snowden" ) ; gApi.groups ( ) . id ( privilegedGroup.getGroupUUID ( ) . get ( ) ) . addMembers ( privilegedUser.username ) ; com.google.common.truth.Truth.assertThat ( gApi.groups ( ) . id ( privilegedGroup.getGroupUUID ( ) . get ( ) ) . members ( ) . get ( 0 ) . email ) . contains ( "snowden" ) ; grant ( secretProject , "refs/*" , Permission.READ , false , privilegedGroup.getGroupUUID ( ) ) ; block ( secretProject , "refs/*" , Permission.READ , SystemGroupBackend.REGISTERED_USERS ) ; deny ( secretRefProject , "refs/*" , Permission.READ , SystemGroupBackend.ANONYMOUS_USERS ) ; grant ( secretRefProject , "refs/heads/secret/*" , Permission.READ , false , privilegedGroup.getGroupUUID ( ) ) ; block ( secretRefProject , "refs/heads/secret/*" , Permission.READ , SystemGroupBackend.REGISTERED_USERS ) ; grant ( secretRefProject , "refs/heads/*" , Permission.READ , false , SystemGroupBackend.REGISTERED_USERS ) ; grant ( normalProject , "refs/*" , Permission.VIEW_PRIVATE_CHANGES , false , privilegedGroup.getGroupUUID ( ) ) ; grant ( normalProject , "refs/*" , Permission.FORGE_SERVER , false , privilegedGroup.getGroupUUID ( ) ) ; }
Source:
private static java.lang.String getUserPreference ( ) { if ( com.google.gerrit.client.Gerrit.isSignedIn ( ) ) { com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadScheme pref = com.google.gerrit.client.Gerrit.getUserAccount ( ) . getGeneralPreferences ( ) . getDownloadUrl ( ) ; if ( pref != null ) { switch ( pref ) { case ANON_GIT : return "git" ; case HTTP : case ANON_HTTP : return "http" ; case SSH : return "ssh" ; default : return null ; } } } return null ; }

Target:
private static java.lang.String getUserPreference ( ) { if ( com.google.gerrit.client.Gerrit.isSignedIn ( ) ) { com.google.gerrit.reviewdb.client.AccountGeneralPreferences.DownloadScheme pref = com.google.gerrit.client.Gerrit.getUserAccount ( ) . getGeneralPreferences ( ) . getDownloadUrl ( ) ; if ( pref != null ) { switch ( pref ) { case ANON_GIT : return "git" ; case ANON_HTTP : return "anonymous http" ; case HTTP : return "http" ; case SSH : return "ssh" ; case REPO_DOWNLOAD : return "repo" ; default : return null ; } } } return null ; }
Source:
protected void applyDataRowStyle ( final int newRow ) { table.getCellFormatter ( ) . addStyleName ( newRow , com.google.gerrit.client.ui.FancyFlexTable.C_ARROW , com.google.gerrit.client.ui.FancyFlexTable.S_ICON_CELL ) ; table.getCellFormatter ( ) . addStyleName ( newRow , com.google.gerrit.client.ui.FancyFlexTable.C_ARROW , com.google.gerrit.client.ui.FancyFlexTable.S_LEFT_MOST_CELL ) ; }

Target:
protected void applyDataRowStyle ( final int newRow ) { table.getCellFormatter ( ) . addStyleName ( newRow , com.google.gerrit.client.ui.FancyFlexTable.C_ARROW , Gerrit.RESOURCES.css ( ) . iconCell ( ) ) ; table.getCellFormatter ( ) . addStyleName ( newRow , com.google.gerrit.client.ui.FancyFlexTable.C_ARROW , Gerrit.RESOURCES.css ( ) . leftMostCell ( ) ) ; }
Source:
public static java.lang.String name ( com.google.gerrit.client.account.AccountInfo ai ) { if ( ( ai.name ( ) ) != null ) { return ai.name ( ) ; } java.lang.String email = ai.email ( ) ; if ( email != null ) { int at = email.indexOf ( '@' ) ; return 0 < at ? email.substring ( 0 , at ) : email ; } return com.google.gerrit.client.FormatUtil.nameEmail ( ai ) ; }

Target:
public static java.lang.String name ( com.google.gerrit.client.account.AccountInfo ai ) { if ( ( ( ai.name ( ) ) != null ) && ( ! ( ai.name ( ) . trim ( ) . isEmpty ( ) ) ) ) { return ai.name ( ) ; } java.lang.String email = ai.email ( ) ; if ( email != null ) { int at = email.indexOf ( '@' ) ; return 0 < at ? email.substring ( 0 , at ) : email ; } return com.google.gerrit.client.FormatUtil.nameEmail ( ai ) ; }
Source:
public void newPatchSetByOtherOnReviewableChangeOwnerSelfCcNotifyOwnerInReviewDb ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.readChanges ( ) ) . isFalse ( ) ; com.google.gerrit.acceptance.server.mail.StagedChange sc = stageReviewableChange ( com.google.gerrit.server.account.WatchConfig.NotifyType.NEW_PATCHSETS ) ; pushTo ( sc , "refs/for/master%notify=OWNER" , other , EmailStrategy.CC_ON_OWN_COMMENTS ) ; assertThat ( sender ) . sent ( "newpatchset" , sc ) . to ( sc.owner ) . to ( sc.reviewer , sc.ccer ) . notTo ( sc.starrer , other ) . notTo ( sc.reviewerByEmail , sc.ccerByEmail ) . notTo ( com.google.gerrit.server.account.WatchConfig.NotifyType.NEW_PATCHSETS ) ; }

Target:
public void newPatchSetByOwnerOnReviewableChangeToWip ( ) throws java.lang.Exception { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageReviewableChange ( com.google.gerrit.server.account.WatchConfig.NotifyType.NEW_PATCHSETS ) ; pushTo ( sc , "refs/for/master%wip" , sc.owner ) ; assertThat ( sender ) . notSent ( ) ; }
Source:
public static void suggest ( java.lang.String prefix , int limit , com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.projects.ProjectMap > cb ) { new com.google.gerrit.client.rpc.RestApi ( "/projects/" ) . addParameter ( "p" , prefix ) . addParameter ( "n" , limit ) . addParameterRaw ( "type" , "ALL" ) . addParameterTrue ( "d" ) . background ( ) . get ( com.google.gerrit.client.rpc.NativeMap.copyKeysIntoChildren ( cb ) ) ; }

Target:
public static void suggest ( java.lang.String match , int limit , com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.projects.ProjectMap > cb ) { new com.google.gerrit.client.rpc.RestApi ( "/projects/" ) . addParameter ( "m" , match ) . addParameter ( "n" , limit ) . addParameterRaw ( "type" , "ALL" ) . addParameterTrue ( "d" ) . background ( ) . get ( com.google.gerrit.client.rpc.NativeMap.copyKeysIntoChildren ( cb ) ) ; }
Source:
public void onSuccess ( com.google.gerrit.client.changes.ChangeList result ) { updateColumnsForLabels ( result ) ; sections.get ( 0 ) . display ( result ) ; finishDisplay ( ) ; }

Target:
public void onSuccess ( com.google.gwt.core.client.JsArray < com.google.gerrit.client.changes.ChangeList > result ) { java.util.List < com.google.gerrit.client.changes.ChangeList > cls = com.google.gerrit.client.rpc.Natives.asList ( result ) ; updateColumnsForLabels ( cls.toArray ( new com.google.gerrit.client.changes.ChangeList [ cls.size ( ) ] ) ) ; for ( int i = 0 ; i < ( cls.size ( ) ) ; i ++ ) { sections.get ( i ) . display ( cls.get ( i ) ) ; } finishDisplay ( ) ; }
Source:
private void columnStatus ( com.google.gwtexpui.safehtml.client.SafeHtmlBuilder sb , com.google.gerrit.client.info.FileInfo info ) { sb.openTd ( ) . setStyleName ( com.google.gerrit.client.change.FileTable.R.css ( ) . status ( ) ) ; if ( ( ( ! ( Patch.COMMIT_MSG.equals ( info.path ( ) ) ) ) && ( ( info.status ( ) ) != null ) ) && ( ! ( ChangeType.MODIFIED.matches ( info.status ( ) ) ) ) ) { sb.append ( info.status ( ) ) ; } sb.closeTd ( ) ; }

Target:
private void columnStatus ( com.google.gwtexpui.safehtml.client.SafeHtmlBuilder sb , com.google.gerrit.client.info.FileInfo info ) { sb.openTd ( ) . setStyleName ( com.google.gerrit.client.change.FileTable.R.css ( ) . status ( ) ) ; if ( ( ( ! ( com.google.gerrit.reviewdb.client.Patch.isMagic ( info.path ( ) ) ) ) && ( ( info.status ( ) ) != null ) ) && ( ! ( ChangeType.MODIFIED.matches ( info.status ( ) ) ) ) ) { sb.append ( info.status ( ) ) ; } sb.closeTd ( ) ; }
Source:
protected void movePointerTo ( final java.lang.Object oldId ) { if ( oldId != null ) { final int max = table.getRowCount ( ) ; for ( int row = 0 ; row < max ; row ++ ) { final RowItem c = com.google.gerrit.client.ui.NavigationTable.getRowItem ( row ) ; if ( ( c != null ) && ( oldId.equals ( getRowItemKey ( c ) ) ) ) { movePointerTo ( row ) ; break ; } } } }

Target:
protected void movePointerTo ( final java.lang.Object oldId ) { final int row = findRow ( oldId ) ; if ( 0 <= row ) { movePointerTo ( row ) ; } }
Source:
public void stop ( ) { if ( ( scanner ) != null ) { scanner.end ( ) ; } srvInfoImpl.state = ServerInformation.State.SHUTDOWN ; synchronized ( this ) { for ( com.google.gerrit.server.plugins.Plugin p : running.values ( ) ) { p.stop ( ) ; } running.clear ( ) ; disabled.clear ( ) ; broken.clear ( ) ; if ( ( cleanupHandles.size ( ) ) > ( running.size ( ) ) ) { java.lang.System.gc ( ) ; processPendingCleanups ( ) ; } } }

Target:
public void stop ( ) { if ( ( scanner ) != null ) { scanner.end ( ) ; } srvInfoImpl.state = ServerInformation.State.SHUTDOWN ; synchronized ( this ) { for ( com.google.gerrit.server.plugins.Plugin p : running.values ( ) ) { unloadPlugin ( p ) ; } running.clear ( ) ; disabled.clear ( ) ; broken.clear ( ) ; if ( ! ( toCleanup.isEmpty ( ) ) ) { java.lang.System.gc ( ) ; processPendingCleanups ( ) ; } } }
Source:
public com.google.gerrit.server.change.ChangeInserter setDraft ( boolean draft ) { change.setStatus ( ( draft ? Change.Status.DRAFT : Change.Status.NEW ) ) ; patchSet.setDraft ( draft ) ; return this ; }

Target:
public com.google.gerrit.server.change.ChangeInserter setStatus ( com.google.gerrit.reviewdb.client.Change.Status status ) { com.google.common.base.Preconditions.checkState ( ( ( change ) == null ) , "setStatus(Change.Status) only valid before creating change" ) ; this . status = status ; if ( Change.Status.DRAFT.equals ( status ) ) { patchSet.setDraft ( true ) ; } return this ; }
Source:
public void testUnblockLargerScope_Fails ( ) { grant ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.ANONYMOUS , "refs/heads/master" ) . setBlock ( ) ; grant ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.DEVS , "refs/heads/*" ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; assertFalse ( "u can't push" , u.controlForRef ( "refs/heads/master" ) . canUpdate ( ) ) ; }

Target:
public void testUnblockLargerScope_Fails ( ) { com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.ANONYMOUS , "refs/heads/master" ) . setBlock ( ) ; com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.DEVS , "refs/heads/*" ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; assertFalse ( "u can't push" , u.controlForRef ( "refs/heads/master" ) . canUpdate ( ) ) ; }
Source:
public boolean match ( final com.google.gerrit.server.query.change.ChangeData object ) throws com.google.gwtorm.server.OrmException { for ( com.google.gerrit.reviewdb.client.PatchSet p : object.patches ( dbProvider ) ) { if ( ( ( p.getRevision ( ) ) != null ) && ( ( p.getRevision ( ) . get ( ) ) != null ) ) { final org.eclipse.jgit.lib.ObjectId id = org.eclipse.jgit.lib.ObjectId.fromString ( p.getRevision ( ) . get ( ) ) ; if ( ( abbreviated ( ) . prefixCompare ( id ) ) == 0 ) { return true ; } } } return false ; }

Target:
public boolean match ( final com.google.gerrit.server.query.change.ChangeData object ) throws com.google.gwtorm.server.OrmException { for ( com.google.gerrit.reviewdb.client.PatchSet p : object.patches ( dbProvider ) ) { if ( ( ( p.getRevision ( ) ) != null ) && ( ( p.getRevision ( ) . get ( ) ) != null ) ) { final org.eclipse.jgit.lib.ObjectId id = org.eclipse.jgit.lib.ObjectId.fromString ( p.getRevision ( ) . get ( ) ) ; if ( ( abbrevId.prefixCompare ( id ) ) == 0 ) { return true ; } } } return false ; }
Source:
private static com.google.gitiles.doc.NamedAnchorNode findAnchor ( org.pegdown.ast.Node node ) { for ( org.pegdown.ast.Node child : node.getChildren ( ) ) { if ( child instanceof com.google.gitiles.doc.NamedAnchorNode ) { return ( ( com.google.gitiles.doc.NamedAnchorNode ) ( child ) ) ; } com.google.gitiles.doc.NamedAnchorNode anchor = com.google.gitiles.doc.TocFormatter.findAnchor ( child ) ; if ( anchor != null ) { return anchor ; } } return null ; }

Target:
private static com.google.gitiles.doc.NamedAnchor findAnchor ( org.commonmark.node.Node node ) { for ( org.commonmark.node.Node c = node.getFirstChild ( ) ; c != null ; c = c.getNext ( ) ) { if ( c instanceof com.google.gitiles.doc.NamedAnchor ) { return ( ( com.google.gitiles.doc.NamedAnchor ) ( c ) ) ; } com.google.gitiles.doc.NamedAnchor anchor = com.google.gitiles.doc.TocFormatter.findAnchor ( c ) ; if ( anchor != null ) { return anchor ; } } return null ; }
Source:
public void newPatchSetByOtherOnReviewableChangeOwnerSelfCcNotifyNone ( ) throws java.lang.Exception { com.google.gerrit.acceptance.server.mail.StagedChange sc = stageReviewableChange ( com.google.gerrit.server.account.WatchConfig.NotifyType.NEW_PATCHSETS ) ; pushTo ( sc , "refs/for/master%notify=NONE" , other , EmailStrategy.CC_ON_OWN_COMMENTS ) ; assertThat ( sender ) . notSent ( ) ; }

Target:
public void newPatchSetOnWipChangeNotifyAllInNoteDb ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.readChanges ( ) ) . isTrue ( ) ; com.google.gerrit.acceptance.server.mail.StagedChange sc = stageWipChange ( ) ; pushTo ( sc , "refs/for/master%wip,notify=ALL" , sc.owner ) ; assertThat ( sender ) . sent ( "newpatchset" , sc ) . to ( sc.reviewer ) . cc ( sc.ccer ) . cc ( sc.reviewerByEmail , sc.ccerByEmail ) . bcc ( sc.starrer ) . bcc ( com.google.gerrit.server.account.WatchConfig.NotifyType.NEW_PATCHSETS ) . noOneElse ( ) ; }
Source:
private void verifyComment ( com.google.gerrit.reviewdb.client.PatchLineComment c ) { com.google.common.base.Preconditions.checkArgument ( ( ( c.getRevId ( ) ) != null ) ) ; com.google.common.base.Preconditions.checkArgument ( ( ( c.getStatus ( ) ) == ( com.google.gerrit.reviewdb.client.PatchLineComment.Status.PUBLISHED ) ) , ( "Cannot add a draft comment to a ChangeUpdate. Use a ChangeDraftUpdate" + " for draft comments" ) ) ; com.google.common.base.Preconditions.checkArgument ( c.getAuthor ( ) . equals ( getUser ( ) . getAccountId ( ) ) , ( "The author for the following comment does not match the author of" + " this ChangeDraftUpdate (%s): %s" ) , getUser ( ) . getAccountId ( ) , c ) ; }

Target:
private void verifyComment ( com.google.gerrit.reviewdb.client.PatchLineComment c ) { com.google.common.base.Preconditions.checkArgument ( ( ( c.getRevId ( ) ) != null ) ) ; com.google.common.base.Preconditions.checkArgument ( ( ( c.getStatus ( ) ) == ( PatchLineComment.Status.PUBLISHED ) ) , ( "Cannot add a draft comment to a ChangeUpdate. Use a ChangeDraftUpdate" + " for draft comments" ) ) ; com.google.common.base.Preconditions.checkArgument ( c.getAuthor ( ) . equals ( getUser ( ) . getAccountId ( ) ) , ( "The author for the following comment does not match the author of" + " this ChangeDraftUpdate (%s): %s" ) , getUser ( ) . getAccountId ( ) , c ) ; }
Source:
public void displayPopup ( ) { poppingUp = true ; if ( firstPopupLoad ) { populateProjects ( ) ; } else { popup.setPopupPositionAndShow ( popupPosition ) ; com.google.gwtexpui.globalkey.client.GlobalKey.dialog ( popup ) ; try { com.google.gwtexpui.globalkey.client.GlobalKey.addApplication ( popup , new com.google.gwtexpui.globalkey.client.HidePopupPanelCommand ( 0 , com.google.gwt.event.dom.client.KeyCodes.KEY_ESCAPE , popup ) ) ; } catch ( java.lang.Throwable e ) { } projectsTab.setRegisterKeys ( true ) ; projectsTab.finishDisplay ( ) ; poppingUp = false ; } }

Target:
public void displayPopup ( ) { poppingUp = true ; if ( firstPopupLoad ) { populateProjects ( ) ; } else { popup.setPopupPositionAndShow ( popupPosition ) ; com.google.gwtexpui.globalkey.client.GlobalKey.dialog ( popup ) ; try { com.google.gwtexpui.globalkey.client.GlobalKey.addApplication ( popup , new com.google.gwtexpui.globalkey.client.HidePopupPanelCommand ( 0 , com.google.gwt.event.dom.client.KeyCodes.KEY_ESCAPE , popup ) ) ; } catch ( java.lang.Throwable e ) { } projectsTab.setRegisterKeys ( true ) ; projectsTab.finishDisplay ( ) ; filterTxt.setFocus ( true ) ; poppingUp = false ; } }
Source:
public boolean isReviewer ( com.google.gerrit.reviewdb.server.ReviewDb db , @ com.google.gerrit.common.Nullable com.google.gerrit.server.query.change.ChangeData cd ) throws com.google.gwtorm.server.OrmException { if ( getCurrentUser ( ) . isIdentifiedUser ( ) ) { java.util.Collection < com.google.gerrit.reviewdb.client.Account.Id > results = ( cd != null ) ? cd.reviewers ( ) . values ( ) : approvalsUtil.getReviewers ( db , change.getId ( ) ) . values ( ) ; com.google.gerrit.server.IdentifiedUser user = ( ( com.google.gerrit.server.IdentifiedUser ) ( getCurrentUser ( ) ) ) ; return results.contains ( user.getAccountId ( ) ) ; } return false ; }

Target:
private com.google.gerrit.server.query.change.ChangeData changeData ( com.google.gerrit.reviewdb.server.ReviewDb db , @ com.google.gerrit.common.Nullable com.google.gerrit.server.query.change.ChangeData cd ) { return cd != null ? cd : changeDataFactory.create ( db , change ) ; }
Source:
public void myAccount ( final com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.reviewdb.Account > callback ) { run ( callback , new com.google.gerrit.server.rpc.account.Action < com.google.gerrit.client.reviewdb.Account > ( ) { public com.google.gerrit.client.reviewdb.Account run ( com.google.gerrit.client.reviewdb.ReviewDb db ) throws com.google.gerrit.server.rpc.account.Failure { final com.google.gerrit.client.reviewdb.Account a = com.google.gerrit.client.rpc.Common.getAccountCache ( ) . get ( com.google.gerrit.client.rpc.Common.getAccountId ( ) , db ) ; if ( a == null ) { throw new com.google.gerrit.server.rpc.account.Failure ( new com.google.gerrit.client.rpc.NoSuchEntityException ( ) ) ; } return a ; } } ) ; }

Target:
public void myAccount ( final com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.reviewdb.Account > callback ) { callback.onSuccess ( currentUser.get ( ) . getAccount ( ) ) ; }
Source:
public void onClick ( final com.google.gwt.user.client.ui.Widget sender ) { final boolean val = showSiteHeader.isChecked ( ) ; Util.ACCOUNT_SVC.changeShowSiteHeader ( val , new com.google.gerrit.client.rpc.GerritCallback < com.google.gwtjsonrpc.client.VoidResult > ( ) { public void onSuccess ( final com.google.gwtjsonrpc.client.VoidResult result ) { com.google.gerrit.client.Gerrit.getUserAccount ( ) . setShowSiteHeader ( val ) ; com.google.gerrit.client.Gerrit.refreshMenuBar ( ) ; } @ java.lang.Override public void onFailure ( final java.lang.Throwable caught ) { showSiteHeader.setChecked ( ( ! val ) ) ; super . onFailure ( caught ) ; } } ) ; }

Target:
public void onClick ( final com.google.gwt.event.dom.client.ClickEvent event ) { final boolean val = showSiteHeader.getValue ( ) ; Util.ACCOUNT_SVC.changeShowSiteHeader ( val , new com.google.gerrit.client.rpc.GerritCallback < com.google.gwtjsonrpc.client.VoidResult > ( ) { public void onSuccess ( final com.google.gwtjsonrpc.client.VoidResult result ) { com.google.gerrit.client.Gerrit.getUserAccount ( ) . setShowSiteHeader ( val ) ; com.google.gerrit.client.Gerrit.refreshMenuBar ( ) ; } @ java.lang.Override public void onFailure ( final java.lang.Throwable caught ) { showSiteHeader.setValue ( ( ! val ) ) ; super . onFailure ( caught ) ; } } ) ; }
Source:
public static void applyUserPreferences ( ) { if ( ( com.google.gerrit.client.Gerrit.siteHeader ) != null ) { com.google.gerrit.client.Gerrit.siteHeader.setVisible ( com.google.gerrit.client.Gerrit.myAccount.isShowSiteHeader ( ) ) ; } if ( ( com.google.gerrit.client.Gerrit.siteFooter ) != null ) { com.google.gerrit.client.Gerrit.siteFooter.setVisible ( com.google.gerrit.client.Gerrit.myAccount.isShowSiteHeader ( ) ) ; } }

Target:
public static void applyUserPreferences ( ) { final com.google.gerrit.client.reviewdb.AccountGeneralPreferences p = com.google.gerrit.client.Gerrit.myAccount.getGeneralPreferences ( ) ; if ( ( com.google.gerrit.client.Gerrit.siteHeader ) != null ) { com.google.gerrit.client.Gerrit.siteHeader.setVisible ( p.isShowSiteHeader ( ) ) ; } if ( ( com.google.gerrit.client.Gerrit.siteFooter ) != null ) { com.google.gerrit.client.Gerrit.siteFooter.setVisible ( p.isShowSiteHeader ( ) ) ; } }
Source:
public boolean isVisible ( ) { return ( ( projectControl.visibleForReplication ( ) ) || ( canPerform ( Permission.READ ) ) ) && ( canRead ( ) ) ; }

Target:
public boolean canUpdate ( ) { if ( ( GitRepositoryManager.REF_CONFIG.equals ( refName ) ) && ( ! ( projectControl.isOwner ( ) ) ) ) { if ( ! ( ( projectControl.getProjectState ( ) . isAllProjects ( ) ) && ( getCurrentUser ( ) . getCapabilities ( ) . canAdministrateServer ( ) ) ) ) { return false ; } } return ( canPerform ( Permission.PUSH ) ) && ( canWrite ( ) ) ; }
Source:
public void testUnblockInLocal_Fails ( ) { com.google.gerrit.server.project.Util.grant ( util.getParentConfig ( ) , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.ANONYMOUS , "refs/heads/*" ) . setBlock ( ) ; com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.PUSH , fixers , "refs/heads/*" ) ; com.google.gerrit.server.project.ProjectControl f = util.user ( local , fixers ) ; org.junit.Assert.assertFalse ( "u can't push" , f.controlForRef ( "refs/heads/master" ) . canUpdate ( ) ) ; }

Target:
public void testUnblockInLocal_Fails ( ) { com.google.gerrit.server.project.Util.grant ( util.getParentConfig ( ) , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/heads/*" ) . setBlock ( ) ; com.google.gerrit.server.project.Util.grant ( local , com.google.gerrit.common.data.Permission.PUSH , fixers , "refs/heads/*" ) ; com.google.gerrit.server.project.ProjectControl f = util.user ( local , fixers ) ; org.junit.Assert.assertFalse ( "u can't push" , f.controlForRef ( "refs/heads/master" ) . canUpdate ( ) ) ; }
Source:
private void assertNoNewMessageSince ( com.google.gerrit.acceptance.PushOneCommit.Result r , java.sql.Timestamp date ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gwtorm.server.OrmException { com.google.common.truth.Truth.assertThat ( getLastMessage ( r ) . date ) . isEqualTo ( date ) ; }

Target:
private void assertNoNewMessageSince ( com.google.gerrit.acceptance.PushOneCommit.Result r , com.google.gerrit.extensions.common.ChangeMessageInfo expected ) throws java.lang.Exception { com.google.common.base.Preconditions.checkNotNull ( expected ) ; com.google.gerrit.extensions.common.ChangeMessageInfo last = getLastMessage ( r ) ; com.google.common.truth.Truth.assertThat ( last.message ) . isEqualTo ( expected.message ) ; com.google.common.truth.Truth.assertThat ( last.id ) . isEqualTo ( expected.id ) ; }
Source:
public static boolean includedInOne ( final org.eclipse.jgit.lib.Repository repo , final org.eclipse.jgit.revwalk.RevWalk rw , final org.eclipse.jgit.revwalk.RevCommit commit , final java.util.Collection < org.eclipse.jgit.lib.Ref > refs ) throws java.io.IOException { return new com.google.gerrit.server.change.IncludedInResolver ( repo , rw , commit ) . includedInOne ( refs ) ; }

Target:
public static boolean includedInOne ( final org.eclipse.jgit.lib.Repository repo , final org.eclipse.jgit.revwalk.RevWalk rw , final org.eclipse.jgit.revwalk.RevCommit commit , final java.util.Collection < org.eclipse.jgit.lib.Ref > refs ) throws java.io.IOException { org.eclipse.jgit.revwalk.RevFlag flag = com.google.gerrit.server.change.IncludedInResolver.newFlag ( rw ) ; try { return new com.google.gerrit.server.change.IncludedInResolver ( repo , rw , commit , flag ) . includedInOne ( refs ) ; } finally { rw.disposeFlag ( flag ) ; } }
Source:
private static com.google.gerrit.client.rpc.RestApi queryWithParameter ( java.lang.String query ) { return new com.google.gerrit.client.rpc.RestApi ( com.google.gerrit.client.changes.ChangeList.URI ) . addParameterRaw ( "q" , com.google.gwtorm.client.KeyUtil.encode ( query ) ) ; }

Target:
private static com.google.gerrit.client.rpc.RestApi newQuery ( java.lang.String query ) { com.google.gerrit.client.rpc.RestApi call = new com.google.gerrit.client.rpc.RestApi ( com.google.gerrit.client.changes.ChangeList.URI ) ; if ( ( ! ( "status:open" . equals ( query ) ) ) && ( ! ( "is:open" . equals ( query ) ) ) ) { call.addParameterRaw ( "q" , com.google.gwtorm.client.KeyUtil.encode ( query ) ) ; } return call ; }