auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
private com.google.gerrit.server.project.ChangeControl incrementPatchSet ( com.google.gerrit.server.project.ChangeControl ctl ) throws java.lang.Exception { return incrementPatchSet ( ctl , patchSetCommit ( nextPatchSetId ( ctl ) ) ) ; }

Target:
private com.google.gerrit.server.notedb.ChangeNotes incrementPatchSet ( com.google.gerrit.server.notedb.ChangeNotes notes , org.eclipse.jgit.revwalk.RevCommit commit ) throws java.lang.Exception { com.google.gerrit.server.change.PatchSetInserter ins ; try ( com.google.gerrit.server.update.BatchUpdate bu = newUpdate ( notes.getChange ( ) . getOwner ( ) ) ) { ins = patchSetInserterFactory.create ( notes , nextPatchSetId ( notes ) , commit ) . setValidate ( false ) . setFireRevisionCreated ( false ) . setNotify ( NotifyHandling.NONE ) ; bu.addOp ( notes.getChangeId ( ) , ins ) . execute ( ) ; } return reload ( notes ) ; }
Source:
private boolean canEditHashtags ( ) { return ( ( ( ( isOwner ( ) ) || ( getRefControl ( ) . isOwner ( ) ) ) || ( getProjectControl ( ) . isOwner ( ) ) ) || ( getUser ( ) . getCapabilities ( ) . canAdministrateServer ( ) ) ) || ( getRefControl ( ) . canEditHashtags ( ) ) ; }

Target:
private boolean canEditHashtags ( ) { return ( ( ( ( isOwner ( ) ) || ( getRefControl ( ) . isOwner ( ) ) ) || ( getProjectControl ( ) . isOwner ( ) ) ) || ( getUser ( ) . getCapabilities ( ) . isAdmin_DoNotUse ( ) ) ) || ( getRefControl ( ) . canEditHashtags ( ) ) ; }
Source:
public boolean containsCommentPublished ( com.google.gerrit.reviewdb.client.PatchLineComment c ) { com.google.gerrit.reviewdb.client.PatchSet.Id psId = com.google.gerrit.server.notedb.CommentsInNotesUtil.getCommentPsId ( c ) ; java.util.List < com.google.gerrit.reviewdb.client.PatchLineComment > list = ( ( c.getSide ( ) ) == ( ( short ) ( 0 ) ) ) ? getBaseComments ( ) . get ( psId ) : getPatchSetComments ( ) . get ( psId ) ; for ( com.google.gerrit.reviewdb.client.PatchLineComment l : list ) { if ( c.getKey ( ) . equals ( l.getKey ( ) ) ) { return true ; } } return false ; }

Target:
public boolean containsCommentPublished ( com.google.gerrit.reviewdb.client.PatchLineComment c ) { for ( com.google.gerrit.reviewdb.client.PatchLineComment l : getComments ( ) . values ( ) ) { if ( c.getKey ( ) . equals ( l.getKey ( ) ) ) { return true ; } } return false ; }
Source:
private com.google.gerrit.server.notedb.NoteDbUpdateManager.OpenRepo openRepo ( com.google.gerrit.reviewdb.client.Project.NameKey p ) throws java.io.IOException { org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( p ) ; org.eclipse.jgit.lib.ObjectInserter ins = repo.newObjectInserter ( ) ; return new com.google.gerrit.server.notedb.NoteDbUpdateManager.OpenRepo ( repo , new org.eclipse.jgit.revwalk.RevWalk ( ins.newReader ( ) ) , ins , new com.google.gerrit.server.update.ChainedReceiveCommands ( repo ) , true ) ; }

Target:
private com.google.gerrit.server.notedb.NoteDbUpdateManager.OpenRepo openRepo ( com.google.gerrit.reviewdb.client.Project.NameKey p ) throws java.io.IOException { org.eclipse.jgit.lib.Repository repo = repoManager.openRepository ( p ) ; org.eclipse.jgit.lib.ObjectInserter ins = repo.newObjectInserter ( ) ; org.eclipse.jgit.lib.ObjectReader reader = ins.newReader ( ) ; try ( org.eclipse.jgit.revwalk.RevWalk rw = new org.eclipse.jgit.revwalk.RevWalk ( reader ) ) { return new com.google.gerrit.server.notedb.NoteDbUpdateManager.OpenRepo ( repo , rw , ins , new com.google.gerrit.server.update.ChainedReceiveCommands ( repo ) , true ) { @ java.lang.Override public void close ( ) { reader.close ( ) ; super . close ( ) ; } } ; } }
Source:
public boolean containsComment ( com.google.gerrit.reviewdb.client.PatchLineComment c ) { com.google.common.collect.Table < com.google.gerrit.reviewdb.client.PatchSet.Id , java.lang.String , com.google.gerrit.reviewdb.client.PatchLineComment > t = ( ( c.getSide ( ) ) == ( ( short ) ( 0 ) ) ) ? getDraftBaseComments ( ) : getDraftPsComments ( ) ; return t.contains ( com.google.gerrit.server.notedb.CommentsInNotesUtil.getCommentPsId ( c ) , c.getKey ( ) . get ( ) ) ; }

Target:
protected void onLoad ( ) throws java.io.IOException , org.eclipse.jgit.errors.ConfigInvalidException { org.eclipse.jgit.lib.ObjectId rev = getRevision ( ) ; if ( rev == null ) { loadDefaults ( ) ; return ; } try ( org.eclipse.jgit.revwalk.RevWalk walk = new org.eclipse.jgit.revwalk.RevWalk ( reader ) ; com.google.gerrit.server.notedb.DraftCommentNotesParser parser = new com.google.gerrit.server.notedb.DraftCommentNotesParser ( getChangeId ( ) , walk , rev , repoManager , draftsProject , author ) ) { parser.parseDraftComments ( ) ; comments = com.google.common.collect.ImmutableListMultimap.copyOf ( parser.comments ) ; noteMap = parser.noteMap ; } }
Source:
private boolean isCompressed ( final java.io.File entry ) { final java.lang.String name = entry.getName ( ) ; return ( ( name.endsWith ( ".gz" ) ) || ( name.endsWith ( ".zip" ) ) ) || ( name.endsWith ( ".bz2" ) ) ; }

Target:
private boolean isCompressed ( java.nio.file.Path entry ) { java.lang.String name = entry.getFileName ( ) . toString ( ) ; return ( ( name.endsWith ( ".gz" ) ) || ( name.endsWith ( ".zip" ) ) ) || ( name.endsWith ( ".bz2" ) ) ; }
Source:
public void clone ( int idx , java.lang.String organisation , java.lang.String repository ) { try { com.googlesrouce.gerrit.plugins.github.git.GitCloneJob gitCloneJob = new com.googlesrouce.gerrit.plugins.github.git.GitCloneJob ( idx , cloneFactory.create ( organisation , repository ) ) ; com.googlesrouce.gerrit.plugins.github.git.GitCloner.log.debug ( ( "New Git clone job created: " + gitCloneJob ) ) ; executor.exec ( gitCloneJob ) ; cloneJobs.put ( idx , gitCloneJob ) ; } catch ( java.lang.Throwable e ) { cloneJobs.put ( idx , new com.googlesrouce.gerrit.plugins.github.git.ErrorCloneJob ( idx , organisation , repository , e ) ) ; } }

Target:
public void clone ( int idx , java.lang.String organisation , java.lang.String repository , java.lang.String description ) { try { com.googlesrouce.gerrit.plugins.github.git.GitCloneJob gitCloneJob = new com.googlesrouce.gerrit.plugins.github.git.GitCloneJob ( idx , cloneFactory.create ( organisation , repository , description , user.getUserName ( ) ) ) ; com.googlesrouce.gerrit.plugins.github.git.GitCloner.log.debug ( ( "New Git clone job created: " + gitCloneJob ) ) ; executor.exec ( gitCloneJob ) ; cloneJobs.put ( idx , gitCloneJob ) ; } catch ( java.lang.Throwable e ) { cloneJobs.put ( idx , new com.googlesrouce.gerrit.plugins.github.git.ErrorCloneJob ( idx , organisation , repository , e ) ) ; } }
Source:
private void logWarn ( java.lang.String msg , java.lang.Throwable t ) { if ( com.google.gerrit.server.git.MergeOp.log.isWarnEnabled ( ) ) { com.google.gerrit.server.git.MergeOp.log.warn ( ( ( ( "[" + ( submissionId ) ) + "]" ) + msg ) , t ) ; } }

Target:
private void logError ( java.lang.String msg , java.lang.Throwable t ) { if ( com.google.gerrit.server.git.MergeOp.log.isErrorEnabled ( ) ) { if ( t != null ) { com.google.gerrit.server.git.MergeOp.log.error ( ( ( submissionId ) + msg ) , t ) ; } else { com.google.gerrit.server.git.MergeOp.log.error ( ( ( submissionId ) + msg ) ) ; } } }
Source:
public void resolveLatestCommit ( ) throws java.lang.Exception { com.google.gerrit.common.data.IncludedInDetail detail = resolve ( commit_v2_5 ) ; expTags.add ( com.google.gerrit.server.change.IncludedInResolverTest.TAG_2_5 ) ; expTags.add ( com.google.gerrit.server.change.IncludedInResolverTest.TAG_2_5_ANNOTATED ) ; expTags.add ( com.google.gerrit.server.change.IncludedInResolverTest.TAG_2_5_ANNOTATED_TWICE ) ; assertEquals ( expTags , detail.getTags ( ) ) ; expBranches.add ( com.google.gerrit.server.change.IncludedInResolverTest.BRANCH_2_5 ) ; assertEquals ( expBranches , detail.getBranches ( ) ) ; }

Target:
public void resolveLatestCommit ( ) throws java.lang.Exception { com.google.gerrit.server.change.IncludedInResolver.Result detail = resolve ( commit_v2_5 ) ; expTags.add ( com.google.gerrit.server.change.IncludedInResolverTest.TAG_2_5 ) ; expTags.add ( com.google.gerrit.server.change.IncludedInResolverTest.TAG_2_5_ANNOTATED ) ; expTags.add ( com.google.gerrit.server.change.IncludedInResolverTest.TAG_2_5_ANNOTATED_TWICE ) ; assertEquals ( expTags , detail.getTags ( ) ) ; expBranches.add ( com.google.gerrit.server.change.IncludedInResolverTest.BRANCH_2_5 ) ; assertEquals ( expBranches , detail.getBranches ( ) ) ; }
Source:
public void want ( final com.google.gerrit.reviewdb.Account.Id id ) { if ( ( id != null ) && ( ! ( out.containsKey ( id ) ) ) ) { out.put ( id , accountCache.get ( id ) . getAccount ( ) ) ; } }

Target:
private void fetchWants ( ) { java.util.Set < com.google.gerrit.reviewdb.Account.Id > missing = new java.util.HashSet < com.google.gerrit.reviewdb.Account.Id > ( wants ) ; missing.removeAll ( out.keySet ( ) ) ; for ( java.util.Map.Entry < com.google.gerrit.reviewdb.Account.Id , com.google.gerrit.server.account.AccountState > e : accountCache.getAll ( missing ) . entrySet ( ) ) { out.put ( e.getKey ( ) , e.getValue ( ) . getAccount ( ) ) ; } }
Source:
public void setConfigValuesIfNotSetYet ( org.eclipse.jgit.lib.Config cfg ) { java.util.Set < java.lang.String > subsections = cfg.getSubsections ( com.google.gerrit.server.notedb.NotesMigration.SECTION_NOTE_DB ) ; if ( ! ( subsections.contains ( com.google.gerrit.server.notedb.NoteDbTable.GROUPS.key ( ) ) ) ) { cfg.setBoolean ( com.google.gerrit.server.notedb.NotesMigration.SECTION_NOTE_DB , com.google.gerrit.server.notedb.NoteDbTable.GROUPS.key ( ) , com.google.gerrit.server.notedb.NotesMigration.WRITE , writeToNoteDb ( ) ) ; cfg.setBoolean ( com.google.gerrit.server.notedb.NotesMigration.SECTION_NOTE_DB , com.google.gerrit.server.notedb.NoteDbTable.GROUPS.key ( ) , com.google.gerrit.server.notedb.NotesMigration.READ , readFromNoteDb ( ) ) ; } }

Target:
public void setConfigValuesIfNotSetYet ( org.eclipse.jgit.lib.Config cfg ) { java.util.Set < java.lang.String > subsections = cfg.getSubsections ( com.google.gerrit.server.notedb.NotesMigration.SECTION_NOTE_DB ) ; if ( ! ( subsections.contains ( com.google.gerrit.server.notedb.NoteDbTable.GROUPS.key ( ) ) ) ) { cfg.setBoolean ( com.google.gerrit.server.notedb.NotesMigration.SECTION_NOTE_DB , com.google.gerrit.server.notedb.NoteDbTable.GROUPS.key ( ) , com.google.gerrit.server.notedb.NotesMigration.WRITE , writeToNoteDb ( ) ) ; cfg.setBoolean ( com.google.gerrit.server.notedb.NotesMigration.SECTION_NOTE_DB , com.google.gerrit.server.notedb.NoteDbTable.GROUPS.key ( ) , com.google.gerrit.server.notedb.NotesMigration.READ , readFromNoteDb ( ) ) ; cfg.setBoolean ( com.google.gerrit.server.notedb.NotesMigration.SECTION_NOTE_DB , com.google.gerrit.server.notedb.NoteDbTable.GROUPS.key ( ) , com.google.gerrit.server.notedb.NotesMigration.DISABLE_REVIEW_DB , disableGroupReviewDb ( ) ) ; } }
Source:
private boolean canCompleteImport ( com.google.gerrit.server.project.ProjectResource rsrc ) { com.google.gerrit.server.account.CapabilityControl ctl = currentUserProvider.get ( ) . getCapabilities ( ) ; return ( ctl.canAdministrateServer ( ) ) || ( ( ctl.canPerform ( ( ( ( pluginName ) + "-" ) + ( ImportCapability.ID ) ) ) ) && ( rsrc.getControl ( ) . isOwner ( ) ) ) ; }

Target:
private boolean canCompleteImport ( com.google.gerrit.server.project.ProjectResource rsrc ) { return ( permissionBackend.user ( currentUserProvider ) . testOrFalse ( com.google.gerrit.server.permissions.GlobalPermission.ADMINISTRATE_SERVER ) ) || ( ( permissionBackend.user ( currentUserProvider ) . testOrFalse ( new com.google.gerrit.extensions.api.access.PluginPermission ( pluginName , ImportCapability.ID ) ) ) && ( rsrc.getControl ( ) . isOwner ( ) ) ) ; }
Source:
public com.google.gerrit.extensions.restapi.Response < ? > apply ( com.google.gerrit.server.change.ChangeResource rsrc ) throws com.google.gerrit.extensions.restapi.AuthException , com.google.gerrit.server.project.InvalidChangeOperationException , com.google.gerrit.server.project.NoSuchChangeException , java.io.IOException { com.google.common.base.Optional < com.google.gerrit.server.edit.ChangeEditData > data = editUtil.dataByChange ( rsrc.getChange ( ) ) ; java.util.Map < java.lang.String , com.google.gerrit.extensions.common.EditInfo > result = new java.util.HashMap < > ( ) ; if ( data.isPresent ( ) ) { com.google.gerrit.extensions.common.EditInfo info = com.google.gerrit.server.edit.ChangeEditInfoJson.toEditInfo ( data.get ( ) ) ; result.put ( info.commit.commit , info ) ; } return com.google.gerrit.extensions.restapi.Response.ok ( result ) ; }

Target:
public com.google.gerrit.extensions.restapi.Response < com.google.gerrit.extensions.common.EditInfo > apply ( com.google.gerrit.server.change.ChangeResource rsrc ) throws com.google.gerrit.extensions.restapi.AuthException , com.google.gerrit.extensions.restapi.ResourceNotFoundException , com.google.gerrit.server.project.InvalidChangeOperationException , com.google.gerrit.server.project.NoSuchChangeException , java.io.IOException { com.google.common.base.Optional < com.google.gerrit.server.edit.ChangeEdit > edit = editUtil.byChange ( rsrc.getChange ( ) ) ; if ( edit.isPresent ( ) ) { return com.google.gerrit.extensions.restapi.Response.ok ( editJson.toEditInfo ( edit.get ( ) ) ) ; } return com.google.gerrit.extensions.restapi.Response.none ( ) ; }
Source:
void onDelete ( int idx ) { java.lang.String path = list.get ( idx ) . path ( ) ; com.google.gerrit.client.changes.ChangeFileApi.deleteContent ( curr , path , new com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.VoidResult > ( ) { @ java.lang.Override public void onSuccess ( com.google.gerrit.client.VoidResult result ) { com.google.gerrit.client.Gerrit.display ( com.google.gerrit.common.PageLinks.toChangeInEditMode ( curr.getParentKey ( ) ) ) ; } @ java.lang.Override public void onFailure ( java.lang.Throwable caught ) { } } ) ; }

Target:
void onDelete ( int idx ) { java.lang.String path = list.get ( idx ) . path ( ) ; com.google.gerrit.client.changes.ChangeEditApi.delete ( curr.getParentKey ( ) . get ( ) , path , new com.google.gwt.user.client.rpc.AsyncCallback < com.google.gerrit.client.VoidResult > ( ) { @ java.lang.Override public void onSuccess ( com.google.gerrit.client.VoidResult result ) { com.google.gerrit.client.Gerrit.display ( com.google.gerrit.common.PageLinks.toChangeInEditMode ( curr.getParentKey ( ) ) ) ; } @ java.lang.Override public void onFailure ( java.lang.Throwable caught ) { } } ) ; }
Source:
private void onShowView ( final net.codemirror.lib.CodeMirror cm , final int height ) { cm.operation ( new java.lang.Runnable ( ) { @ java.lang.Override public void run ( ) { cm.setHeight ( height ) ; cm.setOption ( "viewportMargin" , 10 ) ; cm.refresh ( ) ; } } ) ; }

Target:
private net.codemirror.lib.LineWidget addLineWidget ( net.codemirror.lib.CodeMirror cm , int line , final com.google.gwt.user.client.ui.Widget widget , net.codemirror.lib.Configuration options ) { widget.setVisible ( false ) ; net.codemirror.lib.LineWidget lineWidget = cm.addLineWidget ( line , widget.getElement ( ) , options ) ; lineWidget.onFirstRedraw ( new java.lang.Runnable ( ) { @ java.lang.Override public void run ( ) { widget.setVisible ( true ) ; } } ) ; return lineWidget ; }
Source:
public void noRetryOnMessage ( ) throws java.lang.Exception { org.mockito.Mockito.when ( cfgMock.getMaxTries ( ) ) . thenReturn ( 3 ) ; setUpClientMock ( ) ; org.mockito.Mockito.doThrow ( new java.sql.SQLException ( com.ericsson.gerrit.plugins.eventslog.sql.SQLStoreTest.MSG ) ) . when ( eventsDb ) . storeEvent ( mockEvent ) ; }

Target:
public void noRetryOnMessage ( ) throws java.lang.Exception { org.mockito.Mockito.when ( cfgMock.getMaxTries ( ) ) . thenReturn ( 3 ) ; setUpClientMock ( ) ; org.mockito.Mockito.doThrow ( new java.sql.SQLException ( com.ericsson.gerrit.plugins.eventslog.sql.SQLStoreTest.MSG ) ) . when ( eventsDb ) . storeEvent ( mockEvent ) ; store = new com.ericsson.gerrit.plugins.eventslog.sql.SQLStore ( userProviderMock , cfgMock , eventsDb , localEventsDb , poolMock , permissionBackendMock ) ; store.start ( ) ; store.storeEvent ( mockEvent ) ; org.mockito.Mockito.verify ( eventsDb , org.mockito.Mockito.times ( 1 ) ) . storeEvent ( mockEvent ) ; }
Source:
public void start ( ) { queue.getDefaultQueue ( ) . execute ( compressor ) ; org.joda.time.DateTime now = org.joda.time.DateTime.now ( ) ; long milliSecondsUntil11am = new org.joda.time.Duration ( now , now.withTimeAtStartOfDay ( ) . plusHours ( 23 ) ) . getMillis ( ) ; queue.getDefaultQueue ( ) . scheduleAtFixedRate ( compressor , milliSecondsUntil11am , java.util.concurrent.TimeUnit.HOURS.toMillis ( 24 ) , java.util.concurrent.TimeUnit.MILLISECONDS ) ; }

Target:
public void start ( ) { queue.getDefaultQueue ( ) . execute ( compressor ) ; java.time.ZoneId zone = java.time.ZoneId.systemDefault ( ) ; java.time.LocalDate now = java.time.LocalDate.now ( zone ) ; long milliSecondsUntil11pm = now.atStartOfDay ( zone ) . plusHours ( 23 ) . toInstant ( ) . toEpochMilli ( ) ; queue.getDefaultQueue ( ) . scheduleAtFixedRate ( compressor , milliSecondsUntil11pm , java.util.concurrent.TimeUnit.HOURS.toMillis ( 24 ) , java.util.concurrent.TimeUnit.MILLISECONDS ) ; }
Source:
public void testGetJGroupsSkipInterface ( ) throws java.lang.Exception { com.google.common.truth.Truth.assertThat ( getConfiguration ( ) . jgroups ( ) . skipInterface ( ) ) . isEqualTo ( com.ericsson.gerrit.plugins.highavailability.Configuration.DEFAULT_SKIP_INTERFACE_LIST ) ; globalPluginConfig.setStringList ( com.ericsson.gerrit.plugins.highavailability.Configuration.JGROUPS_SECTION , null , com.ericsson.gerrit.plugins.highavailability.Configuration.SKIP_INTERFACE_KEY , com.google.common.collect.Lists.newArrayList ( "lo*" , "eth0" ) ) ; com.google.common.truth.Truth.assertThat ( getConfiguration ( ) . jgroups ( ) . skipInterface ( ) ) . containsAllOf ( "lo*" , "eth0" ) . inOrder ( ) ; }

Target:
public void testGetJGroupsSkipInterface ( ) throws java.lang.Exception { com.google.common.truth.Truth.assertThat ( getConfiguration ( ) . jgroups ( ) . skipInterface ( ) ) . isEqualTo ( com.ericsson.gerrit.plugins.highavailability.Configuration.DEFAULT_SKIP_INTERFACE_LIST ) ; globalPluginConfig.setStringList ( com.ericsson.gerrit.plugins.highavailability.Configuration.JGROUPS_SECTION , null , com.ericsson.gerrit.plugins.highavailability.Configuration.SKIP_INTERFACE_KEY , com.google.common.collect.ImmutableList.of ( "lo*" , "eth0" ) ) ; com.google.common.truth.Truth.assertThat ( getConfiguration ( ) . jgroups ( ) . skipInterface ( ) ) . containsAllOf ( "lo*" , "eth0" ) . inOrder ( ) ; }
Source:
private void deleteDraftChange ( com.google.gerrit.reviewdb.client.PatchSet.Id patchSetId ) throws com.google.gerrit.extensions.restapi.ResourceNotFoundException , com.google.gwtorm.server.OrmException , java.io.IOException { try { com.google.gerrit.server.ChangeUtil.deleteDraftChange ( patchSetId , gitManager , gitRefUpdated , dbProvider.get ( ) ) ; } catch ( com.google.gerrit.server.project.NoSuchChangeException e ) { throw new com.google.gerrit.extensions.restapi.ResourceNotFoundException ( e.getMessage ( ) ) ; } }

Target:
private void deleteDraftChange ( com.google.gerrit.reviewdb.client.PatchSet.Id patchSetId ) throws com.google.gerrit.extensions.restapi.ResourceNotFoundException , com.google.gwtorm.server.OrmException , java.io.IOException { try { com.google.gerrit.server.ChangeUtil.deleteDraftChange ( patchSetId , gitManager , gitRefUpdated , dbProvider.get ( ) , indexer ) ; } catch ( com.google.gerrit.server.project.NoSuchChangeException e ) { throw new com.google.gerrit.extensions.restapi.ResourceNotFoundException ( e.getMessage ( ) ) ; } }
Source:
public com.googlesource.gerrit.plugins.verifystatus.server.GetConfig.ConfigInfo apply ( com.google.gerrit.server.config.ConfigResource resource ) { com.googlesource.gerrit.plugins.verifystatus.server.GetConfig.ConfigInfo info = new com.googlesource.gerrit.plugins.verifystatus.server.GetConfig.ConfigInfo ( ) ; info.showJobsPanel = cfg.getBoolean ( "showJobsPanel" , true ) ; info.showJobsDropDownPanel = cfg.getBoolean ( "showJobsDropDownPanel" , true ) ; return info ; }

Target:
public com.googlesource.gerrit.plugins.verifystatus.server.GetConfig.ConfigInfo apply ( com.google.gerrit.server.config.ConfigResource resource ) { com.googlesource.gerrit.plugins.verifystatus.server.GetConfig.ConfigInfo info = new com.googlesource.gerrit.plugins.verifystatus.server.GetConfig.ConfigInfo ( ) ; info.showJobsPanel = cfg.getBoolean ( "showJobsPanel" , true ) ; info.showJobsDropDownPanel = cfg.getBoolean ( "showJobsDropDownPanel" , true ) ; info.showJobsSummaryPanel = cfg.getBoolean ( "showJobsSummaryPanel" , true ) ; return info ; }
Source:
public int compare ( com.google.gerrit.server.account.AccountInfo a , com.google.gerrit.server.account.AccountInfo b ) { return com.google.common.collect.ComparisonChain.start ( ) . compare ( a.name , b.name , com.google.common.collect.Ordering.natural ( ) . nullsFirst ( ) ) . compare ( a.email , b.email , com.google.common.collect.Ordering.natural ( ) . nullsFirst ( ) ) . compare ( a._account_id , b._account_id , com.google.common.collect.Ordering.natural ( ) . nullsFirst ( ) ) . result ( ) ; }

Target:
public int compare ( com.google.gerrit.server.account.AccountInfo a , com.google.gerrit.server.account.AccountInfo b ) { return com.google.common.collect.ComparisonChain.start ( ) . compare ( a.name , b.name , com.google.common.collect.Ordering.natural ( ) . nullsFirst ( ) ) . compare ( a.email , b.email , com.google.common.collect.Ordering.natural ( ) . nullsFirst ( ) ) . compare ( a._accountId , b._accountId , com.google.common.collect.Ordering.natural ( ) . nullsFirst ( ) ) . result ( ) ; }
Source:
protected java.lang.String velocify ( java.lang.String template ) throws com.google.gerrit.server.mail.EmailException { try { java.io.StringWriter w = new java.io.StringWriter ( ) ; org.apache.velocity.app.Velocity.evaluate ( velocityContext , w , "OutgoingEmail" , template ) ; return w.toString ( ) ; } catch ( java.lang.Exception e ) { throw new com.google.gerrit.server.mail.EmailException ( ( "Velocity template " + template ) , e ) ; } }

Target:
protected java.lang.String velocify ( java.lang.String template ) throws com.google.gerrit.server.mail.EmailException { try { java.io.StringWriter w = new java.io.StringWriter ( ) ; args.velocityRuntime.evaluate ( velocityContext , w , "OutgoingEmail" , template ) ; return w.toString ( ) ; } catch ( java.lang.Exception e ) { throw new com.google.gerrit.server.mail.EmailException ( ( "Cannot format velocity template: " + template ) , e ) ; } }
Source:
public void createProjectWithGitSuffix ( ) throws java.lang.Exception { java.lang.String name = name ( "foo" ) ; com.google.common.truth.Truth.assertThat ( name ) . isEqualTo ( gApi.projects ( ) . create ( ( name + ".git" ) ) . get ( ) . name ) ; org.eclipse.jgit.revwalk.RevCommit head = getRemoteHead ( name , "refs/meta/config" ) ; eventRecorder.assertRefUpdatedEvents ( name , "refs/meta/config" , null , head ) ; eventRecorder.assertRefUpdatedEvents ( name , "refs/heads/master" , new java.lang.String [ ] { } ) ; }

Target:
public void createProjectWithGitSuffix ( ) throws java.lang.Exception { java.lang.String name = name ( "foo" ) ; com.google.common.truth.Truth.assertThat ( name ) . isEqualTo ( gApi.projects ( ) . create ( ( name + ".git" ) ) . get ( ) . name ) ; org.eclipse.jgit.revwalk.RevCommit head = getRemoteHead ( name , RefNames.REFS_CONFIG ) ; eventRecorder.assertRefUpdatedEvents ( name , RefNames.REFS_CONFIG , null , head ) ; eventRecorder.assertRefUpdatedEvents ( name , "refs/heads/master" , new java.lang.String [ ] { } ) ; }
Source:
private void assertResult ( com.google.gerrit.acceptance.RestResponse r , java.util.List < java.lang.String > expected ) throws java.io.IOException { com.google.common.truth.Truth.assertThat ( r.getStatusCode ( ) ) . isEqualTo ( HttpStatus.SC_OK ) ; java.util.List < java.lang.String > result = com.google.gerrit.acceptance.rest.change.HashtagsIT.toHashtagList ( r ) ; com.google.common.truth.Truth.assertThat ( result ) . containsExactlyElementsIn ( expected ) ; }

Target:
public void testGetNoHashtags ( ) throws java.lang.Exception { com.google.gerrit.acceptance.PushOneCommit.Result r = createChange ( ) ; assertThatGet ( r ) . isEmpty ( ) ; }
Source:
private void assertProblems ( com.google.gerrit.server.project.ChangeControl ctl , @ com.google.gerrit.common.Nullable com.google.gerrit.extensions.api.changes.FixInput fix , com.google.gerrit.extensions.common.ProblemInfo first , com.google.gerrit.extensions.common.ProblemInfo ... rest ) { java.util.List < com.google.gerrit.extensions.common.ProblemInfo > expected = new java.util.ArrayList ( ( 1 + ( rest.length ) ) ) ; expected.add ( first ) ; expected.addAll ( java.util.Arrays.asList ( rest ) ) ; com.google.common.truth.Truth.assertThat ( checker.check ( ctl , fix ) . problems ( ) ) . containsExactlyElementsIn ( expected ) . inOrder ( ) ; }

Target:
private void assertNoProblems ( com.google.gerrit.server.notedb.ChangeNotes notes , @ com.google.gerrit.common.Nullable com.google.gerrit.extensions.api.changes.FixInput fix ) throws java.lang.Exception { com.google.common.truth.Truth.assertThat ( checker.check ( controlForNotes ( notes ) , fix ) . problems ( ) ) . isEmpty ( ) ; }
Source:
protected void configureServlets ( ) { serve ( "/static/*" ) . with ( com.google.gerrit.httpd.raw.SiteStaticDirectoryServlet.class ) ; serveGwtUi ( ) ; install ( new com.google.gerrit.server.cache.CacheModule ( ) { @ java.lang.Override protected void configure ( ) { cache ( com.google.gerrit.httpd.raw.StaticModule.CACHE , java.nio.file.Path.class , com.google.gerrit.httpd.raw.ResourceServlet.Resource.class ) . maximumWeight ( ( 1 << 20 ) ) . weigher ( ResourceServlet.Weigher.class ) ; } } ) ; }

Target:
protected void configureServlets ( ) { serveRegex ( "^/Documentation/(.+)$" ) . with ( com.google.inject.Key.get ( javax.servlet.http.HttpServlet.class , com.google.inject.name.Names.named ( com.google.gerrit.httpd.raw.StaticModule.DOC_SERVLET ) ) ) ; serve ( "/static/*" ) . with ( com.google.gerrit.httpd.raw.SiteStaticDirectoryServlet.class ) ; serveGwtUi ( ) ; install ( new com.google.gerrit.server.cache.CacheModule ( ) { @ java.lang.Override protected void configure ( ) { cache ( com.google.gerrit.httpd.raw.StaticModule.CACHE , java.nio.file.Path.class , com.google.gerrit.httpd.raw.ResourceServlet.Resource.class ) . maximumWeight ( ( 1 << 20 ) ) . weigher ( ResourceServlet.Weigher.class ) ; } } ) ; }
Source:
public final int parseArguments ( org.kohsuke.args4j.spi.Parameters params ) throws org.kohsuke.args4j.CmdLineException { final java.lang.String n = params.getParameter ( 0 ) ; final com.google.gerrit.reviewdb.client.AccountGroup group = groupCache.get ( new com.google.gerrit.reviewdb.client.AccountGroup.NameKey ( n ) ) ; if ( group == null ) { throw new org.kohsuke.args4j.CmdLineException ( owner , ( ( "Group \"" + n ) + "\" does not exist" ) ) ; } setter.addValue ( group.getId ( ) ) ; return 1 ; }

Target:
public final int parseArguments ( org.kohsuke.args4j.spi.Parameters params ) throws org.kohsuke.args4j.CmdLineException { final java.lang.String n = params.getParameter ( 0 ) ; java.util.Optional < com.google.gerrit.server.group.InternalGroup > group = groupCache.get ( new com.google.gerrit.reviewdb.client.AccountGroup.NameKey ( n ) ) ; if ( ! ( group.isPresent ( ) ) ) { throw new org.kohsuke.args4j.CmdLineException ( owner , ( ( "Group \"" + n ) + "\" does not exist" ) ) ; } setter.addValue ( group.get ( ) . getId ( ) ) ; return 1 ; }
Source:
public Change.Id cherryPick ( com.google.gerrit.server.update.BatchUpdate.Factory batchUpdateFactory , com.google.gerrit.reviewdb.client.Change change , com.google.gerrit.reviewdb.client.PatchSet patch , java.lang.String message , java.lang.String ref , com.google.gerrit.server.project.RefControl refControl , int parent ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gerrit.server.git.IntegrationException , com.google.gerrit.server.project.InvalidChangeOperationException , com.google.gerrit.server.update.UpdateException , com.google.gwtorm.server.OrmException , java.io.IOException { return cherryPick ( batchUpdateFactory , change.getId ( ) , patch.getId ( ) , change.getDest ( ) , change.getTopic ( ) , change.getProject ( ) , org.eclipse.jgit.lib.ObjectId.fromString ( patch.getRevision ( ) . get ( ) ) , message , ref , refControl , parent ) ; }

Target:
public Change.Id cherryPick ( com.google.gerrit.server.update.BatchUpdate.Factory batchUpdateFactory , com.google.gerrit.reviewdb.client.Change change , com.google.gerrit.reviewdb.client.PatchSet patch , com.google.gerrit.extensions.api.changes.CherryPickInput input , java.lang.String ref , com.google.gerrit.server.project.RefControl refControl ) throws com.google.gerrit.extensions.restapi.RestApiException , com.google.gerrit.server.git.IntegrationException , com.google.gerrit.server.project.InvalidChangeOperationException , com.google.gerrit.server.update.UpdateException , com.google.gwtorm.server.OrmException , java.io.IOException { return cherryPick ( batchUpdateFactory , change.getId ( ) , patch.getId ( ) , change.getDest ( ) , change.getTopic ( ) , change.getProject ( ) , org.eclipse.jgit.lib.ObjectId.fromString ( patch.getRevision ( ) . get ( ) ) , input , ref , refControl ) ; }
Source:
protected void setPageTitle ( final java.lang.String text ) { final java.lang.String old = headerText.getText ( ) ; headerText.setText ( text ) ; if ( ( ( windowTitle ) == null ) || ( ( windowTitle ) == old ) ) { setWindowTitle ( text ) ; } }

Target:
protected void setPageTitle ( final java.lang.String text ) { final java.lang.String old = headerText.getText ( ) ; if ( text.isEmpty ( ) ) { header.setVisible ( false ) ; } else { headerText.setText ( text ) ; header.setVisible ( true ) ; } if ( ( ( windowTitle ) == null ) || ( ( windowTitle ) == old ) ) { setWindowTitle ( text ) ; } }
Source:
private void formatDest ( ) { appendText ( ( "Change " + ( change.getId ( ) ) ) ) ; appendText ( " for " ) ; appendText ( change.getDest ( ) . getShortName ( ) ) ; appendText ( " in " ) ; appendText ( projectName ) ; appendText ( ":\n" ) ; }

Target:
private void formatDest ( ) { appendText ( ( "Change " + ( change.getKey ( ) . abbreviate ( ) ) ) ) ; appendText ( " for " ) ; appendText ( change.getDest ( ) . getShortName ( ) ) ; appendText ( " in " ) ; appendText ( projectName ) ; appendText ( ":\n" ) ; }
Source:
public void setUp ( ) throws java.io.IOException { org.mockito.Mockito.when ( cfgFactoryMock.getGlobalPluginConfig ( pluginName ) ) . thenReturn ( configMock ) ; org.mockito.Mockito.when ( configMock.getString ( com.ericsson.gerrit.plugins.highavailability.Configuration.MAIN_SECTION , null , com.ericsson.gerrit.plugins.highavailability.Configuration.SHARED_DIRECTORY_KEY ) ) . thenReturn ( com.ericsson.gerrit.plugins.highavailability.ConfigurationTest.SHARED_DIRECTORY ) ; HEAD ( affefd ) ; com.ericsson.gerrit.plugins.highavailability.Add support ; com.ericsson.gerrit.plugins.highavailability.cache eviction ; com.ericsson.gerrit.plugins.highavailability.custom caches ; org.mockito.Mockito.when ( configMock.getStringList ( com.ericsson.gerrit.plugins.highavailability.Configuration.CACHE_SECTION , null , com.ericsson.gerrit.plugins.highavailability.Configuration.PATTERN_KEY ) ) . thenReturn ( com.ericsson.gerrit.plugins.highavailability.ConfigurationTest.CUSTOM_CACHE_PATTERNS ) ; }

Target:
public void setUp ( ) throws java.io.IOException { org.mockito.Mockito.when ( cfgFactoryMock.getGlobalPluginConfig ( pluginName ) ) . thenReturn ( configMock ) ; org.mockito.Mockito.when ( configMock.getString ( com.ericsson.gerrit.plugins.highavailability.Configuration.MAIN_SECTION , null , com.ericsson.gerrit.plugins.highavailability.Configuration.SHARED_DIRECTORY_KEY ) ) . thenReturn ( com.ericsson.gerrit.plugins.highavailability.ConfigurationTest.SHARED_DIRECTORY ) ; org.mockito.Mockito.when ( configMock.getEnum ( com.ericsson.gerrit.plugins.highavailability.Configuration.PEER_INFO_SECTION , null , com.ericsson.gerrit.plugins.highavailability.Configuration.STRATEGY_KEY , com.ericsson.gerrit.plugins.highavailability.Configuration.DEFAULT_PEER_INFO_STRATEGY ) ) . thenReturn ( com.ericsson.gerrit.plugins.highavailability.Configuration.DEFAULT_PEER_INFO_STRATEGY ) ; org.mockito.Mockito.when ( configMock.getStringList ( com.ericsson.gerrit.plugins.highavailability.Configuration.CACHE_SECTION , null , com.ericsson.gerrit.plugins.highavailability.Configuration.PATTERN_KEY ) ) . thenReturn ( com.ericsson.gerrit.plugins.highavailability.ConfigurationTest.CUSTOM_CACHE_PATTERNS ) ; site = new com.google.gerrit.server.config.SitePaths ( com.ericsson.gerrit.plugins.highavailability.ConfigurationTest.SITE_PATH ) ; }
Source:
public void testUnblockInParentBlockInLocal ( ) { com.google.gerrit.server.project.Util.block ( util.getParentConfig ( ) , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/heads/*" ) ; com.google.gerrit.server.project.Util.allow ( util.getParentConfig ( ) , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.DEVS , "refs/heads/*" ) ; com.google.gerrit.server.project.Util.block ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.DEVS , "refs/heads/*" ) ; com.google.gerrit.server.project.ProjectControl d = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; org.junit.Assert.assertFalse ( "u can't push" , d.controlForRef ( "refs/heads/master" ) . canUpdate ( ) ) ; }

Target:
public void testUnblockInParentBlockInLocal ( ) { com.google.gerrit.server.project.Util.block ( parent , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS , "refs/heads/*" ) ; com.google.gerrit.server.project.Util.allow ( parent , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.DEVS , "refs/heads/*" ) ; com.google.gerrit.server.project.Util.block ( local , com.google.gerrit.common.data.Permission.PUSH , com.google.gerrit.server.project.Util.DEVS , "refs/heads/*" ) ; com.google.gerrit.server.project.ProjectControl d = util.user ( local , com.google.gerrit.server.project.Util.DEVS ) ; org.junit.Assert.assertFalse ( "u can't push" , d.controlForRef ( "refs/heads/master" ) . canUpdate ( ) ) ; }
Source:
private GitilesView.Builder parseDiffCommand ( java.lang.String repoName , com.google.gitiles.RevisionParser.Result result , java.lang.String path ) { return com.google.gitiles.GitilesView.diff ( ) . setRepositoryName ( repoName ) . setRevision ( result.getRevision ( ) ) . setOldRevision ( result.getOldRevision ( ) ) . setPathPart ( path.substring ( result.getPathStart ( ) ) ) ; }

Target:
private GitilesView.Builder parseDiffCommand ( java.lang.String repoName , com.google.gitiles.RevisionParser.Result result ) { if ( result == null ) { return null ; } return com.google.gitiles.GitilesView.diff ( ) . setRepositoryName ( repoName ) . setRevision ( result.getRevision ( ) ) . setOldRevision ( result.getOldRevision ( ) ) . setPathPart ( result.getPath ( ) ) ; }
Source:
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 ) ; }

Target:
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 ( repo1 , newChange ( repo1 ) ) ; com.google.gerrit.reviewdb.client.Change change2 = insert ( repo2 , newChange ( repo2 ) ) ; assertQuery ( "project:foo" ) ; assertQuery ( "project:repo" ) ; assertQuery ( "project:repo1" , change1 ) ; assertQuery ( "project:repo2" , change2 ) ; }
Source:
private org.apache.lucene.search.Query timestampQuery ( com.google.gerrit.server.index.IndexPredicate < V > p ) throws com.google.gerrit.index.query.QueryParseException { if ( p instanceof com.google.gerrit.server.index.TimestampRangePredicate ) { com.google.gerrit.server.index.TimestampRangePredicate < V > r = ( ( com.google.gerrit.server.index.TimestampRangePredicate < V > ) ( p ) ) ; return org.apache.lucene.search.NumericRangeQuery.newLongRange ( r.getField ( ) . getName ( ) , r.getMinTimestamp ( ) . getTime ( ) , r.getMaxTimestamp ( ) . getTime ( ) , true , true ) ; } throw new com.google.gerrit.index.query.QueryParseException ( ( "not a timestamp: " + p ) ) ; }

Target:
private org.apache.lucene.search.Query timestampQuery ( com.google.gerrit.index.query.IndexPredicate < V > p ) throws com.google.gerrit.index.query.QueryParseException { if ( p instanceof com.google.gerrit.index.query.TimestampRangePredicate ) { com.google.gerrit.index.query.TimestampRangePredicate < V > r = ( ( com.google.gerrit.index.query.TimestampRangePredicate < V > ) ( p ) ) ; return org.apache.lucene.search.NumericRangeQuery.newLongRange ( r.getField ( ) . getName ( ) , r.getMinTimestamp ( ) . getTime ( ) , r.getMaxTimestamp ( ) . getTime ( ) , true , true ) ; } throw new com.google.gerrit.index.query.QueryParseException ( ( "not a timestamp: " + p ) ) ; }
Source:
public void onFailure ( final java.lang.Throwable caught ) { if ( com.google.gerrit.client.rpc.ScreenLoadCallback.isNoSuchEntity ( caught ) ) { if ( com.google.gerrit.client.Gerrit.isSignedIn ( ) ) { com.google.gerrit.client.Gerrit.display ( screen.getToken ( ) , new com.google.gerrit.client.NotFoundScreen ( ) ) ; } else { new com.google.gerrit.client.NotSignedInDialog ( ) . center ( ) ; } } else { super . onFailure ( caught ) ; } }

Target:
public void onFailure ( final java.lang.Throwable caught ) { if ( com.google.gerrit.client.rpc.ScreenLoadCallback.isSigninFailure ( caught ) ) { new com.google.gerrit.client.NotSignedInDialog ( ) . center ( ) ; } else if ( com.google.gerrit.client.rpc.ScreenLoadCallback.isNoSuchEntity ( caught ) ) { com.google.gerrit.client.Gerrit.display ( screen.getToken ( ) , new com.google.gerrit.client.NotFoundScreen ( ) ) ; } else { super . onFailure ( caught ) ; } }
Source:
protected void configure ( ) { bind ( com.google.gerrit.pgm.util.ConsoleUI.class ) . toInstance ( ui ) ; bind ( java.io.File.class ) . annotatedWith ( com.google.gerrit.server.config.SitePath.class ) . toInstance ( sitePath ) ; java.util.List < java.lang.String > plugins = com.google.gwt.thirdparty.guava.common.base.Objects.firstNonNull ( installPlugins , com.google.common.collect.Lists.< java.lang.String > newArrayList ( ) ) ; bind ( new com.google.inject.TypeLiteral < java.util.List < java.lang.String > > ( ) { } ) . annotatedWith ( com.google.gerrit.pgm.init.InstallPlugins.class ) . toInstance ( plugins ) ; }

Target:
protected void configure ( ) { bind ( com.google.gerrit.pgm.util.ConsoleUI.class ) . toInstance ( ui ) ; bind ( java.io.File.class ) . annotatedWith ( com.google.gerrit.server.config.SitePath.class ) . toInstance ( sitePath ) ; java.util.List < java.lang.String > plugins = com.google.common.base.Objects.firstNonNull ( installPlugins , com.google.common.collect.Lists.< java.lang.String > newArrayList ( ) ) ; bind ( new com.google.inject.TypeLiteral < java.util.List < java.lang.String > > ( ) { } ) . annotatedWith ( com.google.gerrit.pgm.init.InstallPlugins.class ) . toInstance ( plugins ) ; }
Source:
public void dontSkipOnOtherRefs ( ) throws java.lang.Exception { java.lang.String config = "[plugin \"uploadvalidator\"]\n" + ( ( "skipValidation=testOp\n" + "skipRef=refs/heads/myref\n" ) + "skipGroup=testGroup" ) ; com.googlesource.gerrit.plugins.uploadvalidator.ValidatorConfig validatorConfig = new com.googlesource.gerrit.plugins.uploadvalidator.ValidatorConfig ( new com.googlesource.gerrit.plugins.uploadvalidator.FakeConfigFactory ( projectName , config ) , new com.googlesource.gerrit.plugins.uploadvalidator.FakeUserProvider ( "testGroup" ) , new com.googlesource.gerrit.plugins.uploadvalidator.FakeGroupCacheUUIDByName ( ) ) ; com.google.common.truth.Truth.assertThat ( validatorConfig.isEnabledForRef ( projectName , "refs/heads/anotherRef" , "testOp" ) ) . isTrue ( ) ; }

Target:
public void dontSkipOnOtherRefs ( ) throws java.lang.Exception { java.lang.String config = "[plugin \"uploadvalidator\"]\n" + ( ( "skipValidation=testOp\n" + "skipRef=refs/heads/myref\n" ) + "skipGroup=testGroup" ) ; com.googlesource.gerrit.plugins.uploadvalidator.ValidatorConfig validatorConfig = new com.googlesource.gerrit.plugins.uploadvalidator.ValidatorConfig ( new com.googlesource.gerrit.plugins.uploadvalidator.FakeConfigFactory ( projectName , config ) , new com.googlesource.gerrit.plugins.uploadvalidator.FakeGroupCacheUUIDByName ( ) ) ; com.google.common.truth.Truth.assertThat ( validatorConfig.isEnabledForRef ( anyUser , projectName , "refs/heads/anotherRef" , "testOp" ) ) . isTrue ( ) ; }
Source:
public void setUp ( ) throws java.lang.Exception { sessionOwner = new com.google.gerrit.acceptance.RestSession ( server , user ) ; com.google.gerrit.acceptance.SshSession sshSession = new com.google.gerrit.acceptance.SshSession ( server , user ) ; com.google.gerrit.acceptance.GitUtil.initSsh ( user ) ; sshSession.open ( ) ; testRepo = com.google.gerrit.acceptance.GitUtil.cloneProject ( project , sshSession ) ; sshSession.close ( ) ; user2 = accounts.user2 ( ) ; sessionDev = new com.google.gerrit.acceptance.RestSession ( server , user2 ) ; }

Target:
public void setUp ( ) throws java.lang.Exception { setApiUser ( user ) ; sessionOwner = new com.google.gerrit.acceptance.RestSession ( server , user ) ; user2 = accounts.user2 ( ) ; sessionDev = new com.google.gerrit.acceptance.RestSession ( server , user2 ) ; }
Source:
public static com.google.gerrit.server.account.AuthRequest forUser ( final java.lang.String username ) { final com.google.gerrit.server.account.AuthRequest r ; r = new com.google.gerrit.server.account.AuthRequest ( ( ( com.google.gerrit.reviewdb.AccountExternalId.SCHEME_GERRIT ) + username ) ) ; r.setSshUserName ( username ) ; return r ; }

Target:
public static com.google.gerrit.server.account.AuthRequest forUser ( final java.lang.String username ) { final com.google.gerrit.reviewdb.AccountExternalId.Key i = new com.google.gerrit.reviewdb.AccountExternalId.Key ( com.google.gerrit.reviewdb.AccountExternalId.SCHEME_GERRIT , username ) ; final com.google.gerrit.server.account.AuthRequest r = new com.google.gerrit.server.account.AuthRequest ( i.get ( ) ) ; r.setUserName ( username ) ; return r ; }
Source:
private static java.lang.String getUiSwitcherUrl ( java.lang.String token ) { com.google.gwt.http.client.UrlBuilder builder = new com.google.gwt.http.client.UrlBuilder ( ) ; builder.setProtocol ( com.google.gwt.user.client.Window.Location.getProtocol ( ) ) ; builder.setHost ( com.google.gwt.user.client.Window.Location.getHost ( ) ) ; java.lang.String port = com.google.gwt.user.client.Window.Location.getPort ( ) ; if ( ( port != null ) && ( ! ( port.isEmpty ( ) ) ) ) { builder.setPort ( java.lang.Integer.parseInt ( port ) ) ; } java.lang.String [ ] tokens = token.split ( "@" , 2 ) ; builder.setPath ( tokens [ 0 ] ) ; if ( ( tokens.length ) == 2 ) { builder.setHash ( tokens [ 1 ] ) ; } builder.setParameter ( "polygerrit" , "1" ) ; return builder.buildString ( ) ; }

Target:
private static java.lang.String getUiSwitcherUrl ( java.lang.String token ) { com.google.gwt.http.client.UrlBuilder builder = new com.google.gwt.http.client.UrlBuilder ( ) ; builder.setProtocol ( com.google.gwt.user.client.Window.Location.getProtocol ( ) ) ; builder.setHost ( com.google.gwt.user.client.Window.Location.getHost ( ) ) ; java.lang.String port = com.google.gwt.user.client.Window.Location.getPort ( ) ; if ( ( port != null ) && ( ! ( port.isEmpty ( ) ) ) ) { builder.setPort ( java.lang.Integer.parseInt ( port ) ) ; } java.lang.String [ ] tokens = token.split ( "@" , 2 ) ; if ( ( com.google.gwt.user.client.Window.Location.getPath ( ) . endsWith ( "/" ) ) && ( tokens [ 0 ] . startsWith ( "/" ) ) ) { tokens [ 0 ] = tokens [ 0 ] . substring ( 1 ) ; } builder.setPath ( ( ( com.google.gwt.user.client.Window.Location.getPath ( ) ) + ( tokens [ 0 ] ) ) ) ; if ( ( tokens.length ) == 2 ) { builder.setHash ( tokens [ 1 ] ) ; } builder.setParameter ( "polygerrit" , "1" ) ; return builder.buildString ( ) ; }
Source:
private void initBranchLink ( com.google.gerrit.client.changes.ChangeInfo info ) { branchLink.setText ( info.branch ( ) ) ; branchLink.setTargetHistoryToken ( com.google.gerrit.common.PageLinks.toChangeQuery ( com.google.gerrit.client.ui.BranchLink.query ( info.project_name_key ( ) , info.status ( ) , info.branch ( ) , null ) ) ) ; }

Target:
private void initBranchLink ( com.google.gerrit.client.changes.ChangeInfo info ) { branchLink.setText ( info.branch ( ) ) ; branchLink.setTargetHistoryToken ( com.google.gerrit.common.PageLinks.toChangeQuery ( com.google.gerrit.client.ui.BranchLink.query ( info.projectNameKey ( ) , info.status ( ) , info.branch ( ) , null ) ) ) ; }
Source:
private void assertDeleteForbidden ( ) throws java.lang.Exception { com.google.common.truth.Truth.assertThat ( branch ( ) . get ( ) . canDelete ) . isNull ( ) ; exception.expect ( com.google.gerrit.extensions.restapi.AuthException.class ) ; exception.expectMessage ( "delete not permitted" ) ; branch ( ) . delete ( ) ; }

Target:
private void assertDeleteSucceeds ( com.google.gerrit.reviewdb.client.Branch.NameKey branch ) throws java.lang.Exception { com.google.common.truth.Truth.assertThat ( branch ( branch ) . get ( ) . canDelete ) . isTrue ( ) ; java.lang.String branchRev = branch ( branch ) . get ( ) . revision ; branch ( branch ) . delete ( ) ; eventRecorder.assertRefUpdatedEvents ( project.get ( ) , branch.get ( ) , null , branchRev , branchRev , null ) ; exception.expect ( com.google.gerrit.extensions.restapi.ResourceNotFoundException.class ) ; branch ( branch ) . get ( ) ; }
Source:
public void allRefsVisibleNoRefsMetaConfig ( ) throws java.lang.Exception { com.google.gerrit.server.git.ProjectConfig cfg = projectCache.checkedGet ( project ) . getConfig ( ) ; com.google.gerrit.server.project.Util.allow ( cfg , Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/*" ) ; com.google.gerrit.server.project.Util.allow ( cfg , Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.PROJECT_OWNERS , "refs/meta/config" ) ; com.google.gerrit.server.project.Util.doNotInherit ( cfg , Permission.READ , "refs/meta/config" ) ; saveProjectConfig ( project , cfg ) ; assertRefs ( "HEAD" , "refs/changes/01/1/1" , "refs/changes/02/2/1" , "refs/heads/branch" , "refs/heads/master" ) ; }

Target:
public void allRefsVisibleNoRefsMetaConfig ( ) throws java.lang.Exception { com.google.gerrit.server.git.ProjectConfig cfg = projectCache.checkedGet ( project ) . getConfig ( ) ; com.google.gerrit.server.project.Util.allow ( cfg , Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.REGISTERED_USERS , "refs/*" ) ; com.google.gerrit.server.project.Util.allow ( cfg , Permission.READ , com.google.gerrit.server.group.SystemGroupBackend.PROJECT_OWNERS , "refs/meta/config" ) ; com.google.gerrit.server.project.Util.doNotInherit ( cfg , Permission.READ , "refs/meta/config" ) ; saveProjectConfig ( project , cfg ) ; assertRefs ( "HEAD" , "refs/changes/01/1/1" , "refs/changes/01/1/meta" , "refs/changes/02/2/1" , "refs/changes/02/2/meta" , "refs/heads/branch" , "refs/heads/master" ) ; }