auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
protected void run ( ) throws com.google.gerrit.sshd.commands.UnloggedFailure { try { if ( luceneVersionManager.startReindexer ( name ) ) { stdout.println ( "Reindexer started" ) ; } else { stdout.println ( "Nothing to reindex, index is already the latest version" ) ; } } catch ( com.google.gerrit.lucene.ReindexerAlreadyRunningException e ) { throw new com.google.gerrit.sshd.commands.UnloggedFailure ( ( "Failed to start reindexer: " + ( e.getMessage ( ) ) ) ) ; } }

Target:
protected void run ( ) throws com.google.gerrit.sshd.commands.UnloggedFailure { try { if ( luceneVersionManager.startReindexer ( name , force ) ) { stdout.println ( "Reindexer started" ) ; } else { stdout.println ( "Nothing to reindex, index is already the latest version" ) ; } } catch ( com.google.gerrit.lucene.ReindexerAlreadyRunningException e ) { throw die ( ( "Failed to start reindexer: " + ( e.getMessage ( ) ) ) ) ; } }
Source:
public void onSuccess ( final java.util.Set < com.google.gerrit.reviewdb.AccountExternalId.Key > removed ) { deleteIdentity.setEnabled ( true ) ; for ( int row = 1 ; row < ( table.getRowCount ( ) ) ; ) { final com.google.gerrit.reviewdb.AccountExternalId k = getRowItem ( row ) ; if ( ( k != null ) && ( removed.contains ( k.getKey ( ) ) ) ) { table.removeRow ( row ) ; } else { row ++ ; } } }

Target:
public void onValueChange ( com.google.gwt.event.logical.shared.ValueChangeEvent < java.lang.Boolean > event ) { updateDeleteButton ( ) ; }
Source:
private java.util.Set < com.google.gerrit.reviewdb.client.AccountGroup.UUID > groupsOf ( com.google.gerrit.reviewdb.client.Account.Id account ) { return new java.util.HashSet ( com.google.common.collect.Sets.filter ( userFactory.create ( account ) . getEffectiveGroups ( ) . getKnownGroups ( ) , new com.google.common.base.Predicate < com.google.gerrit.reviewdb.client.AccountGroup.UUID > ( ) { @ java.lang.Override public boolean apply ( com.google.gerrit.reviewdb.client.AccountGroup.UUID in ) { return ! ( com.google.gerrit.server.group.SystemGroupBackend.isSystemGroup ( in ) ) ; } } ) ) ; }

Target:
com.google.gerrit.server.IdentifiedUser createUser ( ) { return userFactory.create ( otherUser ) ; }
Source:
public void testInheritRead_SingleBranchDoesNotOverrideInherited ( ) { grant ( parent , com.google.gerrit.reviewdb.ApprovalCategory.READ , registered , "refs/*" , 1 , 2 ) ; grant ( local , com.google.gerrit.reviewdb.ApprovalCategory.READ , registered , "refs/heads/foobar" , 1 ) ; com.google.gerrit.server.project.ProjectControl u = user ( ) ; assertTrue ( "can upload" , u.canPushToAtLeastOneRef ( ) ) ; assertTrue ( "can upload refs/heads/master" , u.controlForRef ( "refs/heads/master" ) . canUpload ( ) ) ; assertTrue ( "can upload refs/heads/foobar" , u.controlForRef ( "refs/heads/foobar" ) . canUpload ( ) ) ; }

Target:
public void testInheritRead_SingleBranchDoesNotOverrideInherited ( ) { grant ( parent , com.google.gerrit.common.data.Permission.READ , registered , "refs/*" ) ; grant ( parent , com.google.gerrit.common.data.Permission.PUSH , registered , "refs/for/refs/*" ) ; grant ( local , com.google.gerrit.common.data.Permission.READ , registered , "refs/heads/foobar" ) ; com.google.gerrit.server.project.ProjectControl u = user ( ) ; assertTrue ( "can upload" , u.canPushToAtLeastOneRef ( ) ) ; assertTrue ( "can upload refs/heads/master" , u.controlForRef ( "refs/heads/master" ) . canUpload ( ) ) ; assertTrue ( "can upload refs/heads/foobar" , u.controlForRef ( "refs/heads/foobar" ) . canUpload ( ) ) ; }
Source:
private static java.lang.String getPluginVersion ( java.io.File srcFile ) { java.lang.String srcFileName = srcFile.getName ( ) ; int dashPos = srcFileName.lastIndexOf ( '-' ) ; int dotPos = srcFileName.lastIndexOf ( '.' ) ; return dashPos > 0 ? srcFileName.substring ( ( dashPos + 1 ) , dotPos ) : "0" ; }

Target:
private static java.lang.String getPluginVersion ( java.nio.file.Path srcFile ) { java.lang.String srcFileName = srcFile.getFileName ( ) . toString ( ) ; int dashPos = srcFileName.lastIndexOf ( '-' ) ; int dotPos = srcFileName.lastIndexOf ( '.' ) ; return dashPos > 0 ? srcFileName.substring ( ( dashPos + 1 ) , dotPos ) : "0" ; }
Source:
private com.google.gerrit.server.git.BatchUpdate.ChangeContext newChangeContext ( com.google.gerrit.reviewdb.client.Change.Id id ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Change c = newChanges.get ( id ) ; if ( c == null ) { c = db.changes ( ) . get ( id ) ; } return new com.google.gerrit.server.git.BatchUpdate.ChangeContext ( changeControlFactory.controlFor ( c , user ) ) ; }

Target:
private com.google.gerrit.server.git.BatchUpdate.ChangeContext newChangeContext ( com.google.gerrit.reviewdb.client.Change.Id id ) throws java.lang.Exception { com.google.gerrit.reviewdb.client.Change c = newChanges.get ( id ) ; if ( c == null ) { c = db.changes ( ) . get ( id ) ; } return new com.google.gerrit.server.git.BatchUpdate.ChangeContext ( changeControlFactory.controlFor ( c , user ) , new com.google.gerrit.server.git.BatchUpdateReviewDb ( db ) ) ; }
Source:
public void missingKey ( ) throws java.lang.Exception { com.google.gerrit.gpg.testutil.TestKey key2 = com.google.gerrit.gpg.testutil.TestKey.key2 ( ) ; org.eclipse.jgit.transport.PushCertificate cert = newSignedCert ( validNonce ( ) , key2 ) ; assertProblems ( cert , ( "No public keys found for key ID " + ( com.google.gerrit.gpg.PublicKeyStore.keyIdToString ( key2.getKeyId ( ) ) ) ) ) ; }

Target:
public void missingKey ( ) throws java.lang.Exception { com.google.gerrit.gpg.testutil.TestKey key2 = com.google.gerrit.gpg.testutil.TestKeys.key2 ( ) ; org.eclipse.jgit.transport.PushCertificate cert = newSignedCert ( validNonce ( ) , key2 ) ; assertProblems ( cert , ( "No public keys found for key ID " + ( com.google.gerrit.gpg.PublicKeyStore.keyIdToString ( key2.getKeyId ( ) ) ) ) ) ; }
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 ) ; listener ( ) . to ( com.google.gerrit.lucene.LuceneChangeIndex.class ) ; }

Target:
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 ) ; listener ( ) . to ( com.google.gerrit.lucene.LuceneChangeIndex.class ) ; if ( checkVersion ) { listener ( ) . to ( com.google.gerrit.lucene.IndexVersionCheck.class ) ; } }
Source:
private void initSignatures ( ) { setSignatureFactories ( java.util.Arrays.< org.apache.sshd.common.NamedFactory < org.apache.sshd.common.Signature > > asList ( new org.apache.sshd.common.signature.SignatureDSA.Factory ( ) , new org.apache.sshd.common.signature.SignatureRSA.Factory ( ) , new org.apache.sshd.common.signature.SignatureECDSA.NISTP256Factory ( ) , new org.apache.sshd.common.signature.SignatureECDSA.NISTP384Factory ( ) , new org.apache.sshd.common.signature.SignatureECDSA.NISTP521Factory ( ) ) ) ; }

Target:
private void initMacs ( org.eclipse.jgit.lib.Config cfg ) { java.util.List < org.apache.sshd.common.NamedFactory < org.apache.sshd.common.mac.Mac > > m = org.apache.sshd.common.BaseBuilder.setUpDefaultMacs ( true ) ; setMacFactories ( com.google.gerrit.sshd.SshDaemon.filter ( cfg , "mac" , ( ( org.apache.sshd.common.NamedFactory < org.apache.sshd.common.mac.Mac > [ ] ) ( m.toArray ( new org.apache.sshd.common.NamedFactory [ m.size ( ) ] ) ) ) ) ) ; }
Source:
public void onSuccess ( final com.google.gwtjsonrpc.client.VoidResult result ) { save.setEnabled ( false ) ; final com.google.gerrit.client.reviewdb.Account me = com.google.gerrit.client.Gerrit.getUserAccount ( ) ; me.setFullName ( newName ) ; me.setPreferredEmail ( newEmail ) ; me.setContactInformation ( info ) ; com.google.gerrit.client.Gerrit.refreshMenuBar ( ) ; if ( ( parentScreen ) != null ) { parentScreen.display ( me ) ; } }

Target:
public void onSuccess ( final com.google.gwtjsonrpc.client.VoidResult result ) { registerNewEmail.setEnabled ( false ) ; final com.google.gerrit.client.reviewdb.Account me = com.google.gerrit.client.Gerrit.getUserAccount ( ) ; me.setFullName ( newName ) ; me.setPreferredEmail ( newEmail ) ; me.setContactInformation ( info ) ; com.google.gerrit.client.Gerrit.refreshMenuBar ( ) ; if ( ( parentScreen ) != null ) { parentScreen.display ( me ) ; } }
Source:
private static org.eclipse.jgit.lib.ObjectId writeNewTree ( com.google.gerrit.server.edit.ChangeEditModifier.TreeOperation op , org.eclipse.jgit.revwalk.RevWalk rw , org.eclipse.jgit.lib.ObjectInserter ins , org.eclipse.jgit.revwalk.RevCommit prevEdit , org.eclipse.jgit.lib.ObjectReader reader , java.lang.String fileName , byte [ ] content , org.eclipse.jgit.revwalk.RevCommit base ) throws com.google.gerrit.server.project.InvalidChangeOperationException , java.io.IOException { org.eclipse.jgit.dircache.DirCache newTree = com.google.gerrit.server.edit.ChangeEditModifier.createTree ( reader , prevEdit ) ; com.google.gerrit.server.edit.ChangeEditModifier.editTree ( op , rw , base , newTree.editor ( ) , ins , fileName , content ) ; return newTree.writeTree ( ins ) ; }

Target:
private static org.eclipse.jgit.lib.ObjectId toBlob ( org.eclipse.jgit.lib.ObjectInserter ins , @ com.google.gerrit.common.Nullable com.google.gerrit.extensions.restapi.RawInput content ) throws java.io.IOException { if ( content == null ) { return null ; } long len = content.getContentLength ( ) ; java.io.InputStream in = content.getInputStream ( ) ; if ( len < 0 ) { return ins.insert ( org.eclipse.jgit.lib.Constants.OBJ_BLOB , com.google.common.io.ByteStreams.toByteArray ( in ) ) ; } return ins.insert ( org.eclipse.jgit.lib.Constants.OBJ_BLOB , len , in ) ; }
Source:
private void allowSubmitOnBehalfOf ( ) throws java.lang.Exception { com.google.gerrit.server.git.ProjectConfig cfg = projectCache.checkedGet ( project ) . getConfig ( ) ; com.google.gerrit.server.project.Util.allow ( cfg , Permission.SUBMIT_AS , com.google.gerrit.server.group.SystemGroupBackend.getGroup ( com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS ) . getUUID ( ) , "refs/heads/*" ) ; saveProjectConfig ( project , cfg ) ; }

Target:
private void blockRead ( com.google.gerrit.extensions.common.GroupInfo group ) throws java.lang.Exception { com.google.gerrit.server.git.ProjectConfig cfg = projectCache.checkedGet ( project ) . getConfig ( ) ; com.google.gerrit.server.project.Util.block ( cfg , Permission.READ , new com.google.gerrit.reviewdb.client.AccountGroup.UUID ( group.id ) , "refs/heads/master" ) ; saveProjectConfig ( project , cfg ) ; }
Source:
public boolean match ( final com.google.gerrit.server.query.change.ChangeData object ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.Change c = object.change ( ) ; if ( c == null ) { return false ; } com.google.gerrit.reviewdb.client.PatchSet.Id current = c.currentPatchSetId ( ) ; for ( com.google.gerrit.reviewdb.client.PatchSetApproval p : object.approvals ( ) . get ( current ) ) { if ( ( p.getValue ( ) ) != 0 ) { return true ; } } return false ; }

Target:
private static void checkSchema ( com.google.gerrit.server.index.Schema < com.google.gerrit.server.query.change.ChangeData > schema ) { com.google.common.base.Preconditions.checkArgument ( schema.hasField ( ChangeField.REVIEWEDBY ) , "Schema %s missing field %s" , schema.getVersion ( ) , ChangeField.REVIEWEDBY.getName ( ) ) ; }
Source:
public static java.lang.String readFile ( final java.lang.Class < ? > context , final java.lang.String name ) throws java.io.IOException { final java.io.InputStream in = context.getResourceAsStream ( name ) ; if ( in == null ) { return null ; } try { return com.google.gerrit.httpd.HtmlDomUtil.asString ( in ) ; } catch ( java.io.IOException e ) { throw new java.io.IOException ( ( "Error reading " + name ) , e ) ; } }

Target:
public static java.lang.String readFile ( java.lang.Class < ? > context , java.lang.String name ) throws java.io.IOException { try ( java.io.InputStream in = context.getResourceAsStream ( name ) ) { if ( in == null ) { return null ; } return new java.lang.String ( com.google.common.io.ByteStreams.toByteArray ( in ) , com.google.gerrit.httpd.HtmlDomUtil.ENC ) ; } catch ( java.io.IOException e ) { throw new java.io.IOException ( ( "Error reading " + name ) , e ) ; } }
Source:
public void getProjectsInScopeTest_setProjects ( ) throws java.lang.Exception { defaultSetup ( "automerger.config" ) ; java.util.Set < java.lang.String > otherExpectedProjects = new java.util.HashSet < java.lang.String > ( ) ; otherExpectedProjects.add ( "platform/some/project" ) ; otherExpectedProjects.add ( "platform/other/project" ) ; com.google.common.truth.Truth.assertThat ( configLoader.getProjectsInScope ( "master" , "ds_two" ) ) . isEqualTo ( otherExpectedProjects ) ; }

Target:
public void getProjectsInScopeTest_setProjects ( ) throws java.lang.Exception { defaultSetup ( "automerger.config" ) ; java.util.Set < java.lang.String > otherExpectedProjects = new java.util.HashSet < java.lang.String > ( ) ; otherExpectedProjects.add ( "platform/some/project" ) ; otherExpectedProjects.add ( "platform/other/project" ) ; otherExpectedProjects.add ( "platform/added/project" ) ; com.google.common.truth.Truth.assertThat ( configLoader.getProjectsInScope ( "master" , "ds_two" ) ) . isEqualTo ( otherExpectedProjects ) ; }
Source:
public com.google.gerrit.acceptance.RestResponse post ( java.lang.String endPoint , java.lang.Object content ) throws java.io.IOException { org.apache.http.client.fluent.Request post = org.apache.http.client.fluent.Request.Post ( ( ( ( url ) + "/a" ) + endPoint ) ) ; if ( content != null ) { post.addHeader ( new org.apache.http.message.BasicHeader ( "Content-Type" , "application/json" ) ) ; post.body ( new org.apache.http.entity.StringEntity ( OutputFormat.JSON_COMPACT.newGson ( ) . toJson ( content ) , com.google.common.base.Charsets.UTF_8.name ( ) ) ) ; } return execute ( post ) ; }

Target:
public com.google.gerrit.acceptance.RestResponse post ( java.lang.String endPoint , java.lang.Object content ) throws java.io.IOException { org.apache.http.client.fluent.Request post = org.apache.http.client.fluent.Request.Post ( ( ( ( url ) + "/a" ) + endPoint ) ) ; if ( content != null ) { post.addHeader ( new org.apache.http.message.BasicHeader ( "Content-Type" , "application/json" ) ) ; post.body ( new org.apache.http.entity.StringEntity ( OutputFormat.JSON_COMPACT.newGson ( ) . toJson ( content ) , java.nio.charset.StandardCharsets.UTF_8.name ( ) ) ) ; } return execute ( post ) ; }
Source:
private static void mergeTestConfig ( org.eclipse.jgit.lib.Config cfg ) throws java.io.IOException { java.net.InetSocketAddress http = com.google.gerrit.acceptance.GerritServer.newPort ( ) ; java.net.InetSocketAddress sshd = com.google.gerrit.acceptance.GerritServer.newPort ( ) ; java.lang.String url = ( "http://" + ( com.google.gerrit.acceptance.GerritServer.format ( http ) ) ) + "/" ; cfg.setString ( "gerrit" , null , "canonicalWebUrl" , url ) ; cfg.setString ( "httpd" , null , "listenUrl" , url ) ; cfg.setString ( "sshd" , null , "listenAddress" , com.google.gerrit.acceptance.GerritServer.format ( sshd ) ) ; cfg.setString ( "cache" , null , "directory" , null ) ; cfg.setBoolean ( "sendemail" , null , "enable" , false ) ; cfg.setInt ( "cache" , "projects" , "checkFrequency" , 0 ) ; cfg.setInt ( "plugins" , null , "checkFrequency" , 0 ) ; }

Target:
private static void mergeTestConfig ( org.eclipse.jgit.lib.Config cfg ) throws java.io.IOException { java.net.InetSocketAddress http = com.google.gerrit.acceptance.GerritServer.newPort ( ) ; java.net.InetSocketAddress sshd = com.google.gerrit.acceptance.GerritServer.newPort ( ) ; java.lang.String url = ( "http://" + ( com.google.gerrit.acceptance.GerritServer.format ( http ) ) ) + "/" ; cfg.setString ( "gerrit" , null , "canonicalWebUrl" , url ) ; cfg.setString ( "httpd" , null , "listenUrl" , url ) ; cfg.setString ( "sshd" , null , "listenAddress" , com.google.gerrit.acceptance.GerritServer.format ( sshd ) ) ; cfg.setString ( "cache" , null , "directory" , null ) ; cfg.setString ( "gerrit" , null , "basePath" , "git" ) ; cfg.setBoolean ( "sendemail" , null , "enable" , false ) ; cfg.setInt ( "cache" , "projects" , "checkFrequency" , 0 ) ; cfg.setInt ( "plugins" , null , "checkFrequency" , 0 ) ; }
Source:
public void testMIXED_NoFullNameUser ( ) { setFrom ( "MIXED" ) ; final java.lang.String email = "a.u.thor@test.example.com" ; final com.google.gerrit.reviewdb.client.Account.Id user = user ( null , email ) ; org.easymock.EasyMock.replay ( accountCache ) ; final com.google.gerrit.server.mail.Address r = create ( ) . from ( user ) ; org.junit.Assert.assertNotNull ( r ) ; org.junit.Assert.assertEquals ( "Anonymous Coward (Code Review)" , r.name ) ; org.junit.Assert.assertEquals ( ident.getEmailAddress ( ) , r.email ) ; org.easymock.EasyMock.verify ( accountCache ) ; }

Target:
public void testMIXED_NullUser ( ) { setFrom ( "MIXED" ) ; org.easymock.EasyMock.replay ( accountCache ) ; final com.google.gerrit.server.mail.Address r = create ( ) . from ( null ) ; com.google.common.truth.Truth.assertThat ( r ) . isNotNull ( ) ; com.google.common.truth.Truth.assertThat ( r.name ) . isEqualTo ( ident.getName ( ) ) ; com.google.common.truth.Truth.assertThat ( r.email ) . isEqualTo ( ident.getEmailAddress ( ) ) ; org.easymock.EasyMock.verify ( accountCache ) ; }
Source:
public void generatePreparedStatementSet ( final com.google.gwtorm.jdbc.gen.CodeGenSupport cgs ) { cgs.pushSqlHandle ( ) ; cgs.pushColumnIndex ( ) ; cgs.pushFieldValue ( ) ; cgs.mv.visitMethodInsn ( Opcodes.INVOKESTATIC , org.objectweb.asm.Type.getInternalName ( java.lang.Character.class ) , "toString" , org.objectweb.asm.Type.getMethodDescriptor ( org.objectweb.asm.Type.getType ( java.lang.String.class ) , new org.objectweb.asm.Type [ ] { org.objectweb.asm.Type.CHAR_TYPE } ) ) ; cgs.invokePreparedStatementSet ( getJavaSqlTypeAlias ( ) ) ; }

Target:
public void generatePreparedStatementSet ( final com.google.gwtorm.server.CodeGenSupport cgs ) { cgs.pushSqlHandle ( ) ; cgs.pushColumnIndex ( ) ; cgs.pushFieldValue ( ) ; cgs.mv.visitMethodInsn ( Opcodes.INVOKESTATIC , org.objectweb.asm.Type.getInternalName ( java.lang.Character.class ) , "toString" , org.objectweb.asm.Type.getMethodDescriptor ( org.objectweb.asm.Type.getType ( java.lang.String.class ) , new org.objectweb.asm.Type [ ] { org.objectweb.asm.Type.CHAR_TYPE } ) ) ; cgs.invokePreparedStatementSet ( getJavaSqlTypeAlias ( ) ) ; }
Source:
protected void configure ( ) { final com.google.gerrit.sshd.CommandName gerrit = com.google.gerrit.sshd.Commands.named ( "gerrit" ) ; command ( gerrit , "approve" ) . to ( com.google.gerrit.sshd.commands.ApproveCommand.class ) ; command ( gerrit , "create-account" ) . to ( com.google.gerrit.sshd.commands.AdminCreateAccount.class ) ; command ( gerrit , "create-project" ) . to ( com.google.gerrit.sshd.commands.AdminCreateProject.class ) ; command ( gerrit , "gsql" ) . to ( com.google.gerrit.sshd.commands.AdminQueryShell.class ) ; command ( gerrit , "receive-pack" ) . to ( com.google.gerrit.sshd.commands.Receive.class ) ; command ( gerrit , "replicate" ) . to ( com.google.gerrit.sshd.commands.AdminReplicate.class ) ; }

Target:
protected void configure ( ) { final com.google.gerrit.sshd.CommandName gerrit = com.google.gerrit.sshd.Commands.named ( "gerrit" ) ; command ( gerrit , "approve" ) . to ( com.google.gerrit.sshd.commands.ApproveCommand.class ) ; command ( gerrit , "create-account" ) . to ( com.google.gerrit.sshd.commands.AdminCreateAccount.class ) ; command ( gerrit , "create-project" ) . to ( com.google.gerrit.sshd.commands.CreateProject.class ) ; command ( gerrit , "gsql" ) . to ( com.google.gerrit.sshd.commands.AdminQueryShell.class ) ; command ( gerrit , "receive-pack" ) . to ( com.google.gerrit.sshd.commands.Receive.class ) ; command ( gerrit , "replicate" ) . to ( com.google.gerrit.sshd.commands.AdminReplicate.class ) ; }
Source:
public static void createBranch ( com.google.gerrit.reviewdb.client.Project.NameKey projectName , java.lang.String ref , java.lang.String revision , com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.projects.BranchInfo > cb ) { com.google.gerrit.client.projects.ProjectApi.BranchInput input = com.google.gerrit.client.projects.ProjectApi.BranchInput.create ( ) ; input.setRevision ( revision ) ; new com.google.gerrit.client.rpc.RestApi ( "/projects/" ) . id ( projectName.get ( ) ) . view ( "branches" ) . id ( ref ) . ifNoneMatch ( ) . put ( input , cb ) ; }

Target:
public static void createBranch ( com.google.gerrit.reviewdb.client.Project.NameKey name , java.lang.String ref , java.lang.String revision , com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.projects.BranchInfo > cb ) { com.google.gerrit.client.projects.ProjectApi.BranchInput input = com.google.gerrit.client.projects.ProjectApi.BranchInput.create ( ) ; input.setRevision ( revision ) ; com.google.gerrit.client.projects.ProjectApi.project ( name ) . view ( "branches" ) . id ( ref ) . ifNoneMatch ( ) . put ( input , cb ) ; }
Source:
private java.lang.String bytes ( double value ) { value /= 1024 ; java.lang.String suffix = "k" ; if ( value > 1024 ) { value /= 1024 ; suffix = "m" ; } if ( value > 1024 ) { value /= 1024 ; suffix = "g" ; } return java.lang.String.format ( "%1$6.2f%2$s" , value , suffix ) ; }

Target:
private void jvmSummary ( com.google.gerrit.server.config.GetSummary.JvmSummaryInfo jvmSummary ) { stdout.format ( "JVM: %s %s %s\n" , jvmSummary.vmVendor , jvmSummary.vmName , jvmSummary.vmVersion ) ; stdout.format ( " on %s %s %s\n" , jvmSummary.osName , jvmSummary.osVersion , jvmSummary.osArch ) ; stdout.format ( " running as %s on %s\n" , jvmSummary.user , com.google.common.base.Strings.nullToEmpty ( jvmSummary.host ) ) ; stdout.format ( " cwd %s\n" , jvmSummary.currentWorkingDirectory ) ; stdout.format ( " site %s\n" , jvmSummary.site ) ; }
Source:
public void submitOnPushToRefsMetaConfig ( ) throws java.lang.Exception { grant ( Permission.SUBMIT , project , "refs/for/refs/meta/config" ) ; git ( ) . fetch ( ) . setRefSpecs ( new org.eclipse.jgit.transport.RefSpec ( "refs/meta/config:refs/meta/config" ) ) . call ( ) ; testRepo.reset ( "refs/meta/config" ) ; com.google.gerrit.acceptance.PushOneCommit.Result r = pushTo ( "refs/for/refs/meta/config%submit" ) ; r.assertOkStatus ( ) ; r.assertChange ( Change.Status.MERGED , null , admin ) ; assertSubmitApproval ( r.getPatchSetId ( ) ) ; assertCommit ( project , "refs/meta/config" ) ; }

Target:
public void submitOnPushToRefsMetaConfig ( ) throws java.lang.Exception { grant ( Permission.SUBMIT , project , "refs/for/refs/meta/config" ) ; git ( ) . fetch ( ) . setRefSpecs ( new org.eclipse.jgit.transport.RefSpec ( "refs/meta/config:refs/meta/config" ) ) . call ( ) ; testRepo.reset ( RefNames.REFS_CONFIG ) ; com.google.gerrit.acceptance.PushOneCommit.Result r = pushTo ( "refs/for/refs/meta/config%submit" ) ; r.assertOkStatus ( ) ; r.assertChange ( Change.Status.MERGED , null , admin ) ; assertSubmitApproval ( r.getPatchSetId ( ) ) ; assertCommit ( project , RefNames.REFS_CONFIG ) ; }
Source:
public void projectBare ( ) throws com.google.gerrit.server.query.QueryParseException { org.antlr.runtime.tree.Tree r ; r = com.google.gerrit.server.query.QueryParserTest.parse ( "project:tools/gerrit" ) ; com.google.gerrit.server.query.QueryParserTest.assertSingleWord ( "project" , "tools/gerrit" , r ) ; r = com.google.gerrit.server.query.QueryParserTest.parse ( "project:tools/*" ) ; com.google.gerrit.server.query.QueryParserTest.assertSingleWord ( "project" , "tools/*" , r ) ; }

Target:
public void projectBare ( ) throws com.google.gerrit.index.query.QueryParseException { org.antlr.runtime.tree.Tree r ; r = com.google.gerrit.index.query.QueryParserTest.parse ( "project:tools/gerrit" ) ; com.google.gerrit.index.query.QueryParserTest.assertSingleWord ( "project" , "tools/gerrit" , r ) ; r = com.google.gerrit.index.query.QueryParserTest.parse ( "project:tools/*" ) ; com.google.gerrit.index.query.QueryParserTest.assertSingleWord ( "project" , "tools/*" , r ) ; }
Source:
private Account.Id parseIdent ( org.eclipse.jgit.lib.PersonIdent ident ) throws org.eclipse.jgit.errors.ConfigInvalidException { com.google.gerrit.reviewdb.client.Account.Id id = com.google.gerrit.server.notedb.ChangeNoteUtil.parseIdent ( ident ) ; if ( id == null ) { throw parseException ( "invalid identity, expected <id>@%s: %s" , com.google.gerrit.server.notedb.ChangeNoteUtil.GERRIT_PLACEHOLDER_HOST , ident.getEmailAddress ( ) ) ; } return id ; }

Target:
private Account.Id parseIdent ( org.eclipse.jgit.revwalk.RevCommit commit ) throws org.eclipse.jgit.errors.ConfigInvalidException { org.eclipse.jgit.lib.PersonIdent a = commit.getAuthorIdent ( ) ; org.eclipse.jgit.lib.PersonIdent c = commit.getCommitterIdent ( ) ; if ( ( a.getName ( ) . equals ( c.getName ( ) ) ) && ( a.getEmailAddress ( ) . equals ( c.getEmailAddress ( ) ) ) ) { return null ; } return changeNoteUtil.parseIdent ( commit.getAuthorIdent ( ) , id ) ; }
Source:
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 ( com.google.gerrit.server.account.WatchConfig.NotifyType.NEW_PATCHSETS ) ; pushTo ( sc , "refs/for/master%wip,notify=ALL" , sc.owner ) ; assertThat ( sender ) . sent ( "newpatchset" , sc ) . notTo ( sc.owner ) . to ( sc.reviewer ) . cc ( sc.ccer ) . cc ( sc.reviewerByEmail , sc.ccerByEmail ) . bcc ( sc.starrer ) . bcc ( com.google.gerrit.server.account.WatchConfig.NotifyType.NEW_PATCHSETS ) ; }

Target:
public void newPatchSetOnWipChangeNotifyAllInReviewDb ( ) throws java.lang.Exception { com.google.common.truth.TruthJUnit.assume ( ) . that ( notesMigration.readChanges ( ) ) . isFalse ( ) ; 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 , sc.ccer ) . bcc ( sc.starrer ) . bcc ( com.google.gerrit.server.account.WatchConfig.NotifyType.NEW_PATCHSETS ) . noOneElse ( ) ; }
Source:
public boolean isIdentityTrustable ( final java.util.Collection < com.google.gerrit.client.reviewdb.AccountExternalId > ids ) { switch ( getAuthType ( ) ) { case DEVELOPMENT_BECOME_ANY_ACCOUNT : case HTTP : case HTTP_LDAP : return true ; case OPENID : for ( final com.google.gerrit.client.reviewdb.AccountExternalId e : ids ) { if ( ! ( isTrusted ( e ) ) ) { return false ; } } return true ; default : return false ; } }

Target:
public boolean isIdentityTrustable ( final java.util.Collection < com.google.gerrit.client.reviewdb.AccountExternalId > ids ) { switch ( getAuthType ( ) ) { case DEVELOPMENT_BECOME_ANY_ACCOUNT : case HTTP : case HTTP_LDAP : case LDAP : return true ; case OPENID : for ( final com.google.gerrit.client.reviewdb.AccountExternalId e : ids ) { if ( ! ( isTrusted ( e ) ) ) { return false ; } } return true ; default : return false ; } }
Source:
public com.google.gerrit.server.account.AccountResource parse ( com.google.gerrit.extensions.restapi.TopLevelResource root , com.google.gerrit.extensions.restapi.IdString id ) throws com.google.gerrit.extensions.restapi.AuthException , com.google.gerrit.extensions.restapi.ResourceNotFoundException , com.google.gwtorm.server.OrmException { com.google.gerrit.server.IdentifiedUser user = _parse ( id.get ( ) ) ; if ( user == null ) { throw new com.google.gerrit.extensions.restapi.ResourceNotFoundException ( id ) ; } return new com.google.gerrit.server.account.AccountResource ( user ) ; }

Target:
public com.google.gerrit.server.account.AccountResource parse ( com.google.gerrit.extensions.restapi.TopLevelResource root , com.google.gerrit.extensions.restapi.IdString id ) throws com.google.gerrit.extensions.restapi.AuthException , com.google.gerrit.extensions.restapi.ResourceNotFoundException , com.google.gwtorm.server.OrmException { com.google.gerrit.server.IdentifiedUser user = _parse ( id.get ( ) ) ; if ( user == null ) { throw new com.google.gerrit.extensions.restapi.ResourceNotFoundException ( id ) ; } else if ( ! ( accountControlFactory.get ( ) . canSee ( user.getAccount ( ) ) ) ) { throw new com.google.gerrit.extensions.restapi.ResourceNotFoundException ( id ) ; } return new com.google.gerrit.server.account.AccountResource ( user ) ; }
Source:
public void dropColumn ( java.sql.Statement stmt , java.lang.String tableName , java.lang.String column ) throws java.sql.SQLException { final java.lang.StringBuilder r = new java.lang.StringBuilder ( ) ; r.append ( "ALTER TABLE " ) ; r.append ( tableName ) ; r.append ( " DROP COLUMN " ) ; r.append ( column ) ; stmt.execute ( r.toString ( ) ) ; }

Target:
public void dropColumn ( com.google.gwtorm.client.StatementExecutor e , java.lang.String tableName , java.lang.String column ) throws com.google.gwtorm.client.OrmException { final java.lang.StringBuilder r = new java.lang.StringBuilder ( ) ; r.append ( "ALTER TABLE " ) ; r.append ( tableName ) ; r.append ( " DROP COLUMN " ) ; r.append ( column ) ; e.execute ( r.toString ( ) ) ; }
Source:
private static java.nio.file.FileSystem getDistributionArchive ( ) { try { return com.google.gerrit.launcher.GerritLauncher.getDistributionArchiveFileSystem ( ) ; } catch ( java.io.IOException e ) { if ( ( e instanceof java.io.FileNotFoundException ) && ( GerritLauncher.NOT_ARCHIVED.equals ( e.getMessage ( ) ) ) ) { return null ; } else { com.google.inject.ProvisionException pe = new com.google.inject.ProvisionException ( "Error reading gerrit.war" ) ; pe.initCause ( e ) ; throw pe ; } } }

Target:
private static java.nio.file.FileSystem getDistributionArchive ( ) throws java.io.IOException { java.io.File war ; try { war = com.google.gerrit.launcher.GerritLauncher.getDistributionArchive ( ) ; } catch ( java.io.IOException e ) { if ( ( e instanceof java.io.FileNotFoundException ) && ( GerritLauncher.NOT_ARCHIVED.equals ( e.getMessage ( ) ) ) ) { return null ; } else { com.google.inject.ProvisionException pe = new com.google.inject.ProvisionException ( "Error reading gerrit.war" ) ; pe.initCause ( e ) ; throw pe ; } } return com.google.gerrit.launcher.GerritLauncher.getZipFileSystem ( war.toPath ( ) ) ; }
Source:
private void statesCleanUp ( ) { if ( ( ! ( stateMap.isEmpty ( ) ) ) && ( ! ( isRetrying ( ) ) ) ) { for ( java.util.Map.Entry < java.lang.String , com.googlesource.gerrit.plugins.replication.ReplicationState > entry : stateMap.entries ( ) ) { entry.getValue ( ) . notifyRefReplicated ( projectName.get ( ) , entry.getKey ( ) , uri , RefPushResult.FAILED , null ) ; } } }

Target:
void addState ( java.lang.String ref , com.googlesource.gerrit.plugins.replication.ReplicationState state ) { stateMap.put ( ref , state ) ; }
Source:
public void testPattern ( ) { com.googlesource.gerrit.plugins.hooks.its.ItsConfig itsConfig = createItsConfig ( ) ; org.easymock.EasyMock.expect ( serverConfig.getString ( "commentLink" , "ItsTestName" , "match" ) ) . andReturn ( "TestPattern" ) . atLeastOnce ( ) ; replayMocks ( ) ; assertEquals ( "Expected and generated pattern are not equal" , "TestPattern" , itsConfig.getIssuePattern ( ) . pattern ( ) ) ; }

Target:
public void testPattern ( ) { com.googlesource.gerrit.plugins.hooks.its.ItsConfig itsConfig = createItsConfig ( ) ; org.easymock.EasyMock.expect ( serverConfig.getString ( "commentlink" , "ItsTestName" , "match" ) ) . andReturn ( "TestPattern" ) . atLeastOnce ( ) ; replayMocks ( ) ; assertEquals ( "Expected and generated pattern are not equal" , "TestPattern" , itsConfig.getIssuePattern ( ) . pattern ( ) ) ; }
Source:
public void onSuggestionsReady ( com.google.gerrit.client.ui.Request req , com.google.gerrit.client.ui.Response res ) { if ( ( query ) == ( this ) ) { query = null ; callback.onSuggestionsReady ( req , res ) ; } else { query.start ( ) ; } }

Target:
public void onSuggestionsReady ( com.google.gerrit.client.ui.Request req , com.google.gerrit.client.ui.Response res ) { if ( ( query ) == ( this ) ) { query = null ; last = request.getQuery ( ) ; callback.onSuggestionsReady ( req , res ) ; } else { query.start ( ) ; } }
Source:
public java.util.Map < java.lang.String , java.util.List < com.google.gerrit.extensions.common.CommentInfo > > 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 ) . format ( commentsUtil.publishedByChange ( db.get ( ) , cd.notes ( ) ) ) ; }

Target:
public java.util.Map < java.lang.String , java.util.List < com.google.gerrit.extensions.common.CommentInfo > > 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 ) . newCommentFormatter ( ) . format ( commentsUtil.publishedByChange ( db.get ( ) , cd.notes ( ) ) ) ; }
Source:
public void preferDeleteAtLineBreak ( ) throws java.lang.Exception { java.lang.String a = " abc\n def\n" ; java.lang.String b = " abc\n def\n" ; java.util.List < org.eclipse.jgit.diff.Edit > expected = new org.eclipse.jgit.diff.EditList ( ) ; expected.add ( new org.eclipse.jgit.diff.Edit ( 0 , 2 , 0 , 0 ) ) ; expected.add ( new org.eclipse.jgit.diff.Edit ( 8 , 10 , 6 , 6 ) ) ; com.google.common.truth.Truth.assertThat ( com.google.gerrit.server.patch.IntraLineLoaderTest.intraline ( a , b ) ) . isEqualTo ( expected ) ; }

Target:
public void preferDeleteAtLineBreak ( ) throws java.lang.Exception { java.lang.String a = " abc\n def\n" ; java.lang.String b = " abc\n def\n" ; com.google.common.truth.Truth.assertThat ( com.google.gerrit.server.patch.IntraLineLoaderTest.intraline ( a , b ) ) . isEqualTo ( com.google.gerrit.server.patch.IntraLineLoaderTest.ref ( ) . remove ( " " ) . common ( " abc\n" ) . remove ( " " ) . common ( " def\n" ) . edits ) ; }
Source:
protected void includeWatchers ( com.google.gerrit.reviewdb.client.AccountProjectWatch.NotifyType type ) { try { com.google.gerrit.server.mail.ChangeEmail.Watchers matching = getWatches ( type ) ; add ( RecipientType.TO , matching.to ) ; add ( RecipientType.CC , matching.cc ) ; add ( RecipientType.BCC , matching.bcc ) ; } catch ( com.google.gwtorm.server.OrmException err ) { com.google.gerrit.server.mail.ChangeEmail.log.warn ( ( "Cannot BCC watchers for " + type ) , err ) ; } }

Target:
protected com.google.gerrit.server.project.ProjectState getProjectState ( ) { return projectState ; }
Source:
public void onSuccess ( com.google.gwtjsonrpc.common.VoidResult result ) { java.lang.String nameWithoutSuffix = projectName ; if ( nameWithoutSuffix.endsWith ( ".git" ) ) { nameWithoutSuffix = nameWithoutSuffix.substring ( 0 , ( ( nameWithoutSuffix.length ( ) ) - 4 ) ) ; while ( nameWithoutSuffix.endsWith ( "/" ) ) { nameWithoutSuffix = nameWithoutSuffix.substring ( 0 , ( ( nameWithoutSuffix.length ( ) ) - 1 ) ) ; } } com.google.gwt.user.client.History.newItem ( com.google.gerrit.client.Dispatcher.toProjectAdmin ( new com.google.gerrit.reviewdb.client.Project.NameKey ( nameWithoutSuffix ) , ProjectScreen.INFO ) ) ; }

Target:
public void onSuccess ( com.google.gwtjsonrpc.common.VoidResult result ) { java.lang.String nameWithoutSuffix = com.google.gerrit.common.ProjectUtil.stripGitSuffix ( projectName ) ; com.google.gwt.user.client.History.newItem ( com.google.gerrit.client.Dispatcher.toProjectAdmin ( new com.google.gerrit.reviewdb.client.Project.NameKey ( nameWithoutSuffix ) , ProjectScreen.INFO ) ) ; }
Source:
private void authenticate ( java.lang.String dn , java.lang.String password ) throws com.google.gerrit.server.account.AccountException { final java.util.Properties env = new java.util.Properties ( ) ; env.put ( javax.naming.Context.INITIAL_CONTEXT_FACTORY , com.google.gerrit.server.ldap.LdapRealm.LDAP ) ; env.put ( javax.naming.Context.PROVIDER_URL , server ) ; env.put ( javax.naming.Context.SECURITY_PRINCIPAL , dn ) ; env.put ( javax.naming.Context.SECURITY_CREDENTIALS , ( password != null ? password : "" ) ) ; try { new javax.naming.directory.InitialDirContext ( env ) . close ( ) ; } catch ( javax.naming.NamingException e ) { throw new com.google.gerrit.server.account.AccountException ( "Incorrect username or password" , e ) ; } }

Target:
private void authenticate ( java.lang.String dn , java.lang.String password ) throws com.google.gerrit.server.account.AccountException { final java.util.Properties env = createContextProperties ( ) ; env.put ( javax.naming.Context.SECURITY_AUTHENTICATION , "simple" ) ; env.put ( javax.naming.Context.SECURITY_PRINCIPAL , dn ) ; env.put ( javax.naming.Context.SECURITY_CREDENTIALS , ( password != null ? password : "" ) ) ; try { new javax.naming.directory.InitialDirContext ( env ) . close ( ) ; } catch ( javax.naming.NamingException e ) { throw new com.google.gerrit.server.account.AccountException ( "Incorrect username or password" , e ) ; } }
Source:
public int compare ( com.google.gerrit.server.notedb.rebuild.ChangeRebuilderImpl.Event a , com.google.gerrit.server.notedb.rebuild.ChangeRebuilderImpl.Event b ) { return com.google.common.collect.ComparisonChain.start ( ) . compare ( a.when , b.when ) . compareTrueFirst ( isPatchSet ( a ) , isPatchSet ( b ) ) . compareTrueFirst ( a.predatesChange , b.predatesChange ) . 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 ( ) ; }

Target:
public int compare ( com.google.gerrit.server.notedb.rebuild.Event a , com.google.gerrit.server.notedb.rebuild.Event b ) { return com.google.common.collect.ComparisonChain.start ( ) . compare ( a.when , b.when ) . compareTrueFirst ( isPatchSet ( a ) , isPatchSet ( b ) ) . compareTrueFirst ( a.predatesChange , b.predatesChange ) . 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 onFailure ( java.lang.Throwable caught ) { loadSubmitType ( status , canSubmit ) ; }

Target:
private void renderCommitSubject ( com.google.gerrit.client.changes.ChangeInfo info ) { com.google.gerrit.client.changes.ChangeInfo.RevisionInfo rev = info.revision ( revision ) ; java.lang.String sub = rev.commit ( ) . subject ( ) ; commitSubjectText.setInnerSafeHtml ( commentLinkProcessor.apply ( new com.google.gwtexpui.safehtml.client.SafeHtmlBuilder ( ) . append ( sub ) . linkify ( ) ) ) ; }
Source:
public void onPluginLoad ( ) { com.google.gerrit.plugin.client.Plugin.get ( ) . screen ( "" , new com.googlesource.gerrit.plugins.cookbook.client.IndexScreen.Factory ( ) ) ; com.google.gerrit.plugin.client.Plugin.get ( ) . panel ( GerritUiExtensionPoint.PROFILE_SCREEN_BOTTOM , new com.googlesource.gerrit.plugins.cookbook.client.CookBookProfileExtension.Factory ( ) ) ; com.google.gerrit.plugin.client.Plugin.get ( ) . panel ( GerritUiExtensionPoint.CHANGE_SCREEN_BELOW_CHANGE_INFO_BLOCK , new com.googlesource.gerrit.plugins.cookbook.client.CookBookChangeScreenExtension.Factory ( ) ) ; com.google.gerrit.plugin.client.Plugin.get ( ) . panel ( GerritUiExtensionPoint.CHANGE_SCREEN_HEADER , new com.googlesource.gerrit.plugins.cookbook.client.ChangeScreenStatusExtension.Factory ( ) ) ; }

Target:
public void onPluginLoad ( ) { com.google.gerrit.plugin.client.Plugin.get ( ) . screen ( "" , new com.googlesource.gerrit.plugins.cookbook.client.IndexScreen.Factory ( ) ) ; com.google.gerrit.plugin.client.Plugin.get ( ) . settingsScreen ( "preferences" , "Food Preferences" , new com.googlesource.gerrit.plugins.cookbook.client.FoodPreferencesScreen.Factory ( ) ) ; com.google.gerrit.plugin.client.Plugin.get ( ) . panel ( GerritUiExtensionPoint.PROFILE_SCREEN_BOTTOM , new com.googlesource.gerrit.plugins.cookbook.client.CookBookProfileExtension.Factory ( ) ) ; com.google.gerrit.plugin.client.Plugin.get ( ) . panel ( GerritUiExtensionPoint.CHANGE_SCREEN_BELOW_CHANGE_INFO_BLOCK , new com.googlesource.gerrit.plugins.cookbook.client.CookBookChangeScreenExtension.Factory ( ) ) ; com.google.gerrit.plugin.client.Plugin.get ( ) . panel ( GerritUiExtensionPoint.CHANGE_SCREEN_HEADER , new com.googlesource.gerrit.plugins.cookbook.client.ChangeScreenStatusExtension.Factory ( ) ) ; }
Source:
public void testUnblockMoreSpecificRef_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/*" ) . 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/master" ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; org.junit.Assert.assertFalse ( "u can't push" , u.controlForRef ( "refs/heads/master" ) . canUpdate ( ) ) ; }

Target:
public void testUnblockMoreSpecificRef_Fails ( ) { com.google.gerrit.server.project.Util.grant ( local , 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 , com.google.gerrit.server.project.Util.DEVS , "refs/heads/master" ) ; com.google.gerrit.server.project.ProjectControl u = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; org.junit.Assert.assertFalse ( "u can't push" , u.controlForRef ( "refs/heads/master" ) . canUpdate ( ) ) ; }
Source:
private static java.lang.String getReviewCategoryDisplayInfo ( com.google.gerrit.reviewdb.client.AccountGeneralPreferences.ReviewCategoryStrategy reviewCategoryStrategy , com.google.gerrit.client.account.AccountInfo accountInfo ) { switch ( reviewCategoryStrategy ) { case NAME : return accountInfo.name ( ) ; case EMAIL : return accountInfo.email ( ) ; case ABBREV : return com.google.gerrit.client.changes.ChangeTable2.getAbbreviation ( accountInfo.name ( ) , " " ) ; default : return null ; } }

Target:
private static java.lang.String getReviewCategoryDisplayInfo ( com.google.gerrit.reviewdb.client.AccountGeneralPreferences.ReviewCategoryStrategy reviewCategoryStrategy , com.google.gerrit.client.account.AccountInfo accountInfo ) { switch ( reviewCategoryStrategy ) { case NAME : return accountInfo.name ( ) ; case EMAIL : return accountInfo.email ( ) ; case USERNAME : return accountInfo.username ( ) ; case ABBREV : return com.google.gerrit.client.changes.ChangeTable2.getAbbreviation ( accountInfo.name ( ) , " " ) ; default : return null ; } }
Source:
public void byProject ( ) throws java.lang.Exception { org.eclipse.jgit.junit.TestRepository < com.google.gerrit.testutil.InMemoryRepositoryManager.Repo > repo1 = createProject ( "repo1" ) ; org.eclipse.jgit.junit.TestRepository < com.google.gerrit.testutil.InMemoryRepositoryManager.Repo > repo2 = createProject ( "repo2" ) ; com.google.gerrit.reviewdb.client.Change change1 = insert ( newChange ( repo1 , null , null , null , null ) ) ; com.google.gerrit.reviewdb.client.Change change2 = insert ( newChange ( repo2 , null , null , null , null ) ) ; assertQuery ( "project:foo" ) ; assertQuery ( "project:repo" ) ; assertQuery ( "project:repo1" , change1 ) ; assertQuery ( "project:repo2" , change2 ) ; }

Target:
public void byProjectPrefix ( ) throws java.lang.Exception { org.eclipse.jgit.junit.TestRepository < com.google.gerrit.testutil.InMemoryRepositoryManager.Repo > repo1 = createProject ( "repo1" ) ; org.eclipse.jgit.junit.TestRepository < com.google.gerrit.testutil.InMemoryRepositoryManager.Repo > repo2 = createProject ( "repo2" ) ; com.google.gerrit.reviewdb.client.Change change1 = insert ( newChange ( repo1 ) ) ; com.google.gerrit.reviewdb.client.Change change2 = insert ( newChange ( repo2 ) ) ; assertQuery ( "projects:foo" ) ; assertQuery ( "projects:repo1" , change1 ) ; assertQuery ( "projects:repo2" , change2 ) ; assertQuery ( "projects:repo" , change2 , change1 ) ; }
Source:
static int getMinOwnerVoteLevel ( com.google.gerrit.server.query.change.ChangeData changeData ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.Project.NameKey project = changeData.change ( ) . getProject ( ) ; try { return ( ( com.googlesource.gerrit.plugins.findowners.Config.config ) == null ) || ( project == null ) ? com.googlesource.gerrit.plugins.findowners.Config.minOwnerVoteLevel : com.googlesource.gerrit.plugins.findowners.Config.config.getFromProjectConfigWithInheritance ( project , com.googlesource.gerrit.plugins.findowners.Config.PLUGIN_NAME ) . getInt ( com.googlesource.gerrit.plugins.findowners.Config.MIN_OWNER_VOTE_LEVEL , com.googlesource.gerrit.plugins.findowners.Config.minOwnerVoteLevel ) ; } catch ( com.google.gerrit.server.project.NoSuchProjectException e ) { com.googlesource.gerrit.plugins.findowners.Config.log.error ( ( "Cannot find project: " + project ) , e ) ; return com.googlesource.gerrit.plugins.findowners.Config.minOwnerVoteLevel ; } }

Target:
static int getMinOwnerVoteLevel ( com.google.gerrit.server.query.change.ChangeData changeData ) throws com.google.gwtorm.server.OrmException { com.google.gerrit.reviewdb.client.Project.NameKey project = changeData.change ( ) . getProject ( ) ; try { return ( ( com.googlesource.gerrit.plugins.findowners.Config.config ) == null ) || ( project == null ) ? com.googlesource.gerrit.plugins.findowners.Config.minOwnerVoteLevel : com.googlesource.gerrit.plugins.findowners.Config.config.getFromProjectConfigWithInheritance ( project , com.googlesource.gerrit.plugins.findowners.Config.PLUGIN_NAME ) . getInt ( com.googlesource.gerrit.plugins.findowners.Config.MIN_OWNER_VOTE_LEVEL , com.googlesource.gerrit.plugins.findowners.Config.minOwnerVoteLevel ) ; } catch ( com.google.gerrit.server.project.NoSuchProjectException e ) { com.googlesource.gerrit.plugins.findowners.Config.log.error ( ( ( ( "Cannot find project " + project ) + " for " ) + ( com.googlesource.gerrit.plugins.findowners.Config.getChangeId ( changeData ) ) ) , e ) ; return com.googlesource.gerrit.plugins.findowners.Config.minOwnerVoteLevel ; } }
Source:
private void allowCodeReviewOnBehalfOf ( ) throws java.lang.Exception { com.google.gerrit.server.git.ProjectConfig cfg = projectCache.checkedGet ( project ) . getConfig ( ) ; com.google.gerrit.common.data.LabelType codeReviewType = com.google.gerrit.server.project.Util.codeReview ( ) ; java.lang.String forCodeReviewAs = com.google.gerrit.common.data.Permission.forLabelAs ( codeReviewType.getName ( ) ) ; java.lang.String heads = "refs/heads/*" ; com.google.gerrit.reviewdb.client.AccountGroup.UUID uuid = com.google.gerrit.server.group.SystemGroupBackend.getGroup ( com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS ) . getUUID ( ) ; com.google.gerrit.server.project.Util.allow ( cfg , forCodeReviewAs , ( - 1 ) , 1 , uuid , heads ) ; saveProjectConfig ( project , cfg ) ; }

Target:
private void allowCodeReviewOnBehalfOf ( ) throws java.lang.Exception { com.google.gerrit.server.git.ProjectConfig cfg = projectCache.checkedGet ( project ) . getConfig ( ) ; com.google.gerrit.common.data.LabelType codeReviewType = com.google.gerrit.server.project.Util.codeReview ( ) ; java.lang.String forCodeReviewAs = com.google.gerrit.common.data.Permission.forLabelAs ( codeReviewType.getName ( ) ) ; java.lang.String heads = "refs/heads/*" ; com.google.gerrit.reviewdb.client.AccountGroup.UUID uuid = systemGroupBackend.getGroup ( com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS ) . getUUID ( ) ; com.google.gerrit.server.project.Util.allow ( cfg , forCodeReviewAs , ( - 1 ) , 1 , uuid , heads ) ; saveProjectConfig ( project , cfg ) ; }