mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-01-03 14:19:47 +01:00
merge
This commit is contained in:
@@ -113,92 +113,29 @@
|
||||
<plugin>
|
||||
<groupId>sonia.scm.maven</groupId>
|
||||
<artifactId>smp-maven-plugin</artifactId>
|
||||
<version>1.0.0-alpha-2</version>
|
||||
<version>1.0.0-alpha-3</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<disableCompression>true</disableCompression>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>fix-descriptor</id>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>fix-descriptor</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>append-dependencies</id>
|
||||
<phase>process-classes</phase>
|
||||
<goals>
|
||||
<goal>append-dependencies</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>com.github.sdorra</groupId>
|
||||
<artifactId>buildfrontend-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<node>
|
||||
<version>${nodejs.version}</version>
|
||||
</node>
|
||||
<pkgManager>
|
||||
<type>YARN</type>
|
||||
<version>${yarn.version}</version>
|
||||
</pkgManager>
|
||||
<failOnMissingPackageJson>false</failOnMissingPackageJson>
|
||||
<script>build</script>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>install</id>
|
||||
<phase>process-resources</phase>
|
||||
<goals>
|
||||
<goal>install</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>build</id>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>com.github.sdorra</groupId>
|
||||
<artifactId>buildfrontend-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<node>
|
||||
<version>${nodejs.version}</version>
|
||||
</node>
|
||||
<pkgManager>
|
||||
<type>YARN</type>
|
||||
<version>${yarn.version}</version>
|
||||
</pkgManager>
|
||||
<failOnMissingPackageJson>false</failOnMissingPackageJson>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>release</id>
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
<plugin>
|
||||
<groupId>sonia.maven</groupId>
|
||||
<artifactId>web-compressor</artifactId>
|
||||
<version>1.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>compile</phase>
|
||||
<goals>
|
||||
<goal>compress-directory</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<replace>true</replace>
|
||||
<baseDirectory>${project.build.directory}/classes</baseDirectory>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
|
||||
<profile>
|
||||
<id>doc</id>
|
||||
|
||||
|
||||
@@ -4,5 +4,6 @@
|
||||
[include]
|
||||
|
||||
[libs]
|
||||
./node_modules/@scm-manager/ui-components/flow-typed
|
||||
|
||||
[options]
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
// flow-typed signature: cf86673cc32d185bdab1d2ea90578d37
|
||||
// flow-typed version: 614bf49aa8/classnames_v2.x.x/flow_>=v0.25.x
|
||||
|
||||
type $npm$classnames$Classes =
|
||||
| string
|
||||
| { [className: string]: * }
|
||||
| false
|
||||
| void
|
||||
| null;
|
||||
|
||||
declare module "classnames" {
|
||||
declare module.exports: (
|
||||
...classes: Array<$npm$classnames$Classes | $npm$classnames$Classes[]>
|
||||
) => string;
|
||||
}
|
||||
|
||||
declare module "classnames/bind" {
|
||||
declare module.exports: $Exports<"classnames">;
|
||||
}
|
||||
|
||||
declare module "classnames/dedupe" {
|
||||
declare module.exports: $Exports<"classnames">;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,331 +0,0 @@
|
||||
// flow-typed signature: 23b805356f90ad9384dd88489654e380
|
||||
// flow-typed version: e9374c5fe9/moment_v2.3.x/flow_>=v0.25.x
|
||||
|
||||
type moment$MomentOptions = {
|
||||
y?: number | string,
|
||||
year?: number | string,
|
||||
years?: number | string,
|
||||
M?: number | string,
|
||||
month?: number | string,
|
||||
months?: number | string,
|
||||
d?: number | string,
|
||||
day?: number | string,
|
||||
days?: number | string,
|
||||
date?: number | string,
|
||||
h?: number | string,
|
||||
hour?: number | string,
|
||||
hours?: number | string,
|
||||
m?: number | string,
|
||||
minute?: number | string,
|
||||
minutes?: number | string,
|
||||
s?: number | string,
|
||||
second?: number | string,
|
||||
seconds?: number | string,
|
||||
ms?: number | string,
|
||||
millisecond?: number | string,
|
||||
milliseconds?: number | string
|
||||
};
|
||||
|
||||
type moment$MomentObject = {
|
||||
years: number,
|
||||
months: number,
|
||||
date: number,
|
||||
hours: number,
|
||||
minutes: number,
|
||||
seconds: number,
|
||||
milliseconds: number
|
||||
};
|
||||
|
||||
type moment$MomentCreationData = {
|
||||
input: string,
|
||||
format: string,
|
||||
locale: Object,
|
||||
isUTC: boolean,
|
||||
strict: boolean
|
||||
};
|
||||
|
||||
type moment$CalendarFormat = string | ((moment: moment$Moment) => string);
|
||||
|
||||
type moment$CalendarFormats = {
|
||||
sameDay?: moment$CalendarFormat,
|
||||
nextDay?: moment$CalendarFormat,
|
||||
nextWeek?: moment$CalendarFormat,
|
||||
lastDay?: moment$CalendarFormat,
|
||||
lastWeek?: moment$CalendarFormat,
|
||||
sameElse?: moment$CalendarFormat
|
||||
};
|
||||
|
||||
declare class moment$LocaleData {
|
||||
months(moment: moment$Moment): string,
|
||||
monthsShort(moment: moment$Moment): string,
|
||||
monthsParse(month: string): number,
|
||||
weekdays(moment: moment$Moment): string,
|
||||
weekdaysShort(moment: moment$Moment): string,
|
||||
weekdaysMin(moment: moment$Moment): string,
|
||||
weekdaysParse(weekDay: string): number,
|
||||
longDateFormat(dateFormat: string): string,
|
||||
isPM(date: string): boolean,
|
||||
meridiem(hours: number, minutes: number, isLower: boolean): string,
|
||||
calendar(
|
||||
key:
|
||||
| "sameDay"
|
||||
| "nextDay"
|
||||
| "lastDay"
|
||||
| "nextWeek"
|
||||
| "prevWeek"
|
||||
| "sameElse",
|
||||
moment: moment$Moment
|
||||
): string,
|
||||
relativeTime(
|
||||
number: number,
|
||||
withoutSuffix: boolean,
|
||||
key: "s" | "m" | "mm" | "h" | "hh" | "d" | "dd" | "M" | "MM" | "y" | "yy",
|
||||
isFuture: boolean
|
||||
): string,
|
||||
pastFuture(diff: any, relTime: string): string,
|
||||
ordinal(number: number): string,
|
||||
preparse(str: string): any,
|
||||
postformat(str: string): any,
|
||||
week(moment: moment$Moment): string,
|
||||
invalidDate(): string,
|
||||
firstDayOfWeek(): number,
|
||||
firstDayOfYear(): number
|
||||
}
|
||||
declare class moment$MomentDuration {
|
||||
humanize(suffix?: boolean): string,
|
||||
milliseconds(): number,
|
||||
asMilliseconds(): number,
|
||||
seconds(): number,
|
||||
asSeconds(): number,
|
||||
minutes(): number,
|
||||
asMinutes(): number,
|
||||
hours(): number,
|
||||
asHours(): number,
|
||||
days(): number,
|
||||
asDays(): number,
|
||||
months(): number,
|
||||
asWeeks(): number,
|
||||
weeks(): number,
|
||||
asMonths(): number,
|
||||
years(): number,
|
||||
asYears(): number,
|
||||
add(value: number | moment$MomentDuration | Object, unit?: string): this,
|
||||
subtract(value: number | moment$MomentDuration | Object, unit?: string): this,
|
||||
as(unit: string): number,
|
||||
get(unit: string): number,
|
||||
toJSON(): string,
|
||||
toISOString(): string,
|
||||
isValid(): boolean
|
||||
}
|
||||
declare class moment$Moment {
|
||||
static ISO_8601: string,
|
||||
static (
|
||||
string?: string,
|
||||
format?: string | Array<string>,
|
||||
strict?: boolean
|
||||
): moment$Moment,
|
||||
static (
|
||||
string?: string,
|
||||
format?: string | Array<string>,
|
||||
locale?: string,
|
||||
strict?: boolean
|
||||
): moment$Moment,
|
||||
static (
|
||||
initDate: ?Object | number | Date | Array<number> | moment$Moment | string
|
||||
): moment$Moment,
|
||||
static unix(seconds: number): moment$Moment,
|
||||
static utc(): moment$Moment,
|
||||
static utc(number: number | Array<number>): moment$Moment,
|
||||
static utc(
|
||||
str: string,
|
||||
str2?: string | Array<string>,
|
||||
str3?: string
|
||||
): moment$Moment,
|
||||
static utc(moment: moment$Moment): moment$Moment,
|
||||
static utc(date: Date): moment$Moment,
|
||||
static parseZone(): moment$Moment,
|
||||
static parseZone(rawDate: string): moment$Moment,
|
||||
static parseZone(
|
||||
rawDate: string,
|
||||
format: string | Array<string>
|
||||
): moment$Moment,
|
||||
static parseZone(
|
||||
rawDate: string,
|
||||
format: string,
|
||||
strict: boolean
|
||||
): moment$Moment,
|
||||
static parseZone(
|
||||
rawDate: string,
|
||||
format: string,
|
||||
locale: string,
|
||||
strict: boolean
|
||||
): moment$Moment,
|
||||
isValid(): boolean,
|
||||
invalidAt(): 0 | 1 | 2 | 3 | 4 | 5 | 6,
|
||||
creationData(): moment$MomentCreationData,
|
||||
millisecond(number: number): this,
|
||||
milliseconds(number: number): this,
|
||||
millisecond(): number,
|
||||
milliseconds(): number,
|
||||
second(number: number): this,
|
||||
seconds(number: number): this,
|
||||
second(): number,
|
||||
seconds(): number,
|
||||
minute(number: number): this,
|
||||
minutes(number: number): this,
|
||||
minute(): number,
|
||||
minutes(): number,
|
||||
hour(number: number): this,
|
||||
hours(number: number): this,
|
||||
hour(): number,
|
||||
hours(): number,
|
||||
date(number: number): this,
|
||||
dates(number: number): this,
|
||||
date(): number,
|
||||
dates(): number,
|
||||
day(day: number | string): this,
|
||||
days(day: number | string): this,
|
||||
day(): number,
|
||||
days(): number,
|
||||
weekday(number: number): this,
|
||||
weekday(): number,
|
||||
isoWeekday(number: number): this,
|
||||
isoWeekday(): number,
|
||||
dayOfYear(number: number): this,
|
||||
dayOfYear(): number,
|
||||
week(number: number): this,
|
||||
weeks(number: number): this,
|
||||
week(): number,
|
||||
weeks(): number,
|
||||
isoWeek(number: number): this,
|
||||
isoWeeks(number: number): this,
|
||||
isoWeek(): number,
|
||||
isoWeeks(): number,
|
||||
month(number: number): this,
|
||||
months(number: number): this,
|
||||
month(): number,
|
||||
months(): number,
|
||||
quarter(number: number): this,
|
||||
quarter(): number,
|
||||
year(number: number): this,
|
||||
years(number: number): this,
|
||||
year(): number,
|
||||
years(): number,
|
||||
weekYear(number: number): this,
|
||||
weekYear(): number,
|
||||
isoWeekYear(number: number): this,
|
||||
isoWeekYear(): number,
|
||||
weeksInYear(): number,
|
||||
isoWeeksInYear(): number,
|
||||
get(string: string): number,
|
||||
set(unit: string, value: number): this,
|
||||
set(options: { [unit: string]: number }): this,
|
||||
static max(...dates: Array<moment$Moment>): moment$Moment,
|
||||
static max(dates: Array<moment$Moment>): moment$Moment,
|
||||
static min(...dates: Array<moment$Moment>): moment$Moment,
|
||||
static min(dates: Array<moment$Moment>): moment$Moment,
|
||||
add(
|
||||
value: number | moment$MomentDuration | moment$Moment | Object,
|
||||
unit?: string
|
||||
): this,
|
||||
subtract(
|
||||
value: number | moment$MomentDuration | moment$Moment | string | Object,
|
||||
unit?: string
|
||||
): this,
|
||||
startOf(unit: string): this,
|
||||
endOf(unit: string): this,
|
||||
local(): this,
|
||||
utc(): this,
|
||||
utcOffset(
|
||||
offset: number | string,
|
||||
keepLocalTime?: boolean,
|
||||
keepMinutes?: boolean
|
||||
): this,
|
||||
utcOffset(): number,
|
||||
format(format?: string): string,
|
||||
fromNow(removeSuffix?: boolean): string,
|
||||
from(
|
||||
value: moment$Moment | string | number | Date | Array<number>,
|
||||
removePrefix?: boolean
|
||||
): string,
|
||||
toNow(removePrefix?: boolean): string,
|
||||
to(
|
||||
value: moment$Moment | string | number | Date | Array<number>,
|
||||
removePrefix?: boolean
|
||||
): string,
|
||||
calendar(refTime?: any, formats?: moment$CalendarFormats): string,
|
||||
diff(
|
||||
date: moment$Moment | string | number | Date | Array<number>,
|
||||
format?: string,
|
||||
floating?: boolean
|
||||
): number,
|
||||
valueOf(): number,
|
||||
unix(): number,
|
||||
daysInMonth(): number,
|
||||
toDate(): Date,
|
||||
toArray(): Array<number>,
|
||||
toJSON(): string,
|
||||
toISOString(
|
||||
keepOffset?: boolean
|
||||
): string,
|
||||
toObject(): moment$MomentObject,
|
||||
isBefore(
|
||||
date?: moment$Moment | string | number | Date | Array<number>,
|
||||
units?: ?string
|
||||
): boolean,
|
||||
isSame(
|
||||
date?: moment$Moment | string | number | Date | Array<number>,
|
||||
units?: ?string
|
||||
): boolean,
|
||||
isAfter(
|
||||
date?: moment$Moment | string | number | Date | Array<number>,
|
||||
units?: ?string
|
||||
): boolean,
|
||||
isSameOrBefore(
|
||||
date?: moment$Moment | string | number | Date | Array<number>,
|
||||
units?: ?string
|
||||
): boolean,
|
||||
isSameOrAfter(
|
||||
date?: moment$Moment | string | number | Date | Array<number>,
|
||||
units?: ?string
|
||||
): boolean,
|
||||
isBetween(
|
||||
fromDate: moment$Moment | string | number | Date | Array<number>,
|
||||
toDate?: ?moment$Moment | string | number | Date | Array<number>,
|
||||
granularity?: ?string,
|
||||
inclusion?: ?string
|
||||
): boolean,
|
||||
isDST(): boolean,
|
||||
isDSTShifted(): boolean,
|
||||
isLeapYear(): boolean,
|
||||
clone(): moment$Moment,
|
||||
static isMoment(obj: any): boolean,
|
||||
static isDate(obj: any): boolean,
|
||||
static locale(locale: string, localeData?: Object): string,
|
||||
static updateLocale(locale: string, localeData?: ?Object): void,
|
||||
static locale(locales: Array<string>): string,
|
||||
locale(locale: string, customization?: Object | null): moment$Moment,
|
||||
locale(): string,
|
||||
static months(): Array<string>,
|
||||
static monthsShort(): Array<string>,
|
||||
static weekdays(): Array<string>,
|
||||
static weekdaysShort(): Array<string>,
|
||||
static weekdaysMin(): Array<string>,
|
||||
static months(): string,
|
||||
static monthsShort(): string,
|
||||
static weekdays(): string,
|
||||
static weekdaysShort(): string,
|
||||
static weekdaysMin(): string,
|
||||
static localeData(key?: string): moment$LocaleData,
|
||||
static duration(
|
||||
value: number | Object | string,
|
||||
unit?: string
|
||||
): moment$MomentDuration,
|
||||
static isDuration(obj: any): boolean,
|
||||
static normalizeUnits(unit: string): string,
|
||||
static invalid(object: any): moment$Moment
|
||||
}
|
||||
|
||||
declare module "moment" {
|
||||
declare module.exports: Class<moment$Moment>;
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
// flow-typed signature: ba35d02d668b0d0a3e04a63a6847974e
|
||||
// flow-typed version: <<STUB>>/react-jss_v8.6.1/flow_v0.79.1
|
||||
|
||||
/**
|
||||
* This is an autogenerated libdef stub for:
|
||||
*
|
||||
* 'react-jss'
|
||||
*
|
||||
* Fill this stub out by replacing all the `any` types.
|
||||
*
|
||||
* Once filled out, we encourage you to share your work with the
|
||||
* community by sending a pull request to:
|
||||
* https://github.com/flowtype/flow-typed
|
||||
*/
|
||||
|
||||
declare module 'react-jss' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* We include stubs for each file inside this npm package in case you need to
|
||||
* require those files directly. Feel free to delete any files that aren't
|
||||
* needed.
|
||||
*/
|
||||
declare module 'react-jss/dist/react-jss' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/dist/react-jss.min' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/compose' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/compose.test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/contextTypes' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/createHoc' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/getDisplayName' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/index' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/index.test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/injectSheet' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/injectSheet.test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/jss' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/JssProvider' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/JssProvider.test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/ns' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/propTypes' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
// Filename aliases
|
||||
declare module 'react-jss/dist/react-jss.js' {
|
||||
declare module.exports: $Exports<'react-jss/dist/react-jss'>;
|
||||
}
|
||||
declare module 'react-jss/dist/react-jss.min.js' {
|
||||
declare module.exports: $Exports<'react-jss/dist/react-jss.min'>;
|
||||
}
|
||||
declare module 'react-jss/lib/compose.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/compose'>;
|
||||
}
|
||||
declare module 'react-jss/lib/compose.test.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/compose.test'>;
|
||||
}
|
||||
declare module 'react-jss/lib/contextTypes.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/contextTypes'>;
|
||||
}
|
||||
declare module 'react-jss/lib/createHoc.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/createHoc'>;
|
||||
}
|
||||
declare module 'react-jss/lib/getDisplayName.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/getDisplayName'>;
|
||||
}
|
||||
declare module 'react-jss/lib/index.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/index'>;
|
||||
}
|
||||
declare module 'react-jss/lib/index.test.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/index.test'>;
|
||||
}
|
||||
declare module 'react-jss/lib/injectSheet.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/injectSheet'>;
|
||||
}
|
||||
declare module 'react-jss/lib/injectSheet.test.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/injectSheet.test'>;
|
||||
}
|
||||
declare module 'react-jss/lib/jss.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/jss'>;
|
||||
}
|
||||
declare module 'react-jss/lib/JssProvider.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/JssProvider'>;
|
||||
}
|
||||
declare module 'react-jss/lib/JssProvider.test.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/JssProvider.test'>;
|
||||
}
|
||||
declare module 'react-jss/lib/ns.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/ns'>;
|
||||
}
|
||||
declare module 'react-jss/lib/propTypes.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/propTypes'>;
|
||||
}
|
||||
@@ -1,14 +1,17 @@
|
||||
{
|
||||
"name": "@scm-manager/scm-git-plugin",
|
||||
"license" : "BSD-3-Clause",
|
||||
"license": "BSD-3-Clause",
|
||||
"main": "src/main/js/index.js",
|
||||
"scripts": {
|
||||
"build": "ui-bundler plugin"
|
||||
"build": "ui-bundler plugin",
|
||||
"watch": "ui-bundler plugin -w",
|
||||
"lint": "ui-bundler lint",
|
||||
"flow": "flow check"
|
||||
},
|
||||
"dependencies": {
|
||||
"@scm-manager/ui-extensions": "^0.0.7"
|
||||
"@scm-manager/ui-extensions": "^0.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@scm-manager/ui-bundler": "^0.0.17"
|
||||
"@scm-manager/ui-bundler": "^0.0.21"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,11 +43,24 @@
|
||||
|
||||
</dependencies>
|
||||
|
||||
<!-- create test jar -->
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
<plugin>
|
||||
<groupId>sonia.scm.maven</groupId>
|
||||
<artifactId>smp-maven-plugin</artifactId>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<corePlugin>true</corePlugin>
|
||||
<links>
|
||||
<link>@scm-manager/ui-types</link>
|
||||
<link>@scm-manager/ui-components</link>
|
||||
</links>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!-- create test jar -->
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
@@ -61,33 +74,6 @@
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>com.github.sdorra</groupId>
|
||||
<artifactId>buildfrontend-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>link-ui-types</id>
|
||||
<phase>process-sources</phase>
|
||||
<goals>
|
||||
<goal>install-link</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<pkg>@scm-manager/ui-types</pkg>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>link-ui-components</id>
|
||||
<phase>process-sources</phase>
|
||||
<goals>
|
||||
<goal>install-link</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<pkg>@scm-manager/ui-components</pkg>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
@@ -1,124 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
package sonia.scm.api.rest.resources;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
import sonia.scm.repository.GitConfig;
|
||||
import sonia.scm.repository.GitRepositoryHandler;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@Singleton
|
||||
@Path("config/repositories/git")
|
||||
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
public class GitConfigResource
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param repositoryHandler
|
||||
*/
|
||||
@Inject
|
||||
public GitConfigResource(GitRepositoryHandler repositoryHandler)
|
||||
{
|
||||
this.repositoryHandler = repositoryHandler;
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GET
|
||||
public GitConfig getConfig()
|
||||
{
|
||||
GitConfig config = repositoryHandler.getConfig();
|
||||
|
||||
if (config == null)
|
||||
{
|
||||
config = new GitConfig();
|
||||
repositoryHandler.setConfig(config);
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param uriInfo
|
||||
* @param config
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
public Response setConfig(@Context UriInfo uriInfo, GitConfig config)
|
||||
{
|
||||
repositoryHandler.setConfig(config);
|
||||
repositoryHandler.storeConfig();
|
||||
|
||||
return Response.created(uriInfo.getRequestUri()).build();
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private GitRepositoryHandler repositoryHandler;
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package sonia.scm.repository;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class CloseableWrapper<C> implements AutoCloseable {
|
||||
|
||||
private final C wrapped;
|
||||
private final Consumer<C> cleanup;
|
||||
|
||||
public CloseableWrapper(C wrapped, Consumer<C> cleanup) {
|
||||
this.wrapped = wrapped;
|
||||
this.cleanup = cleanup;
|
||||
}
|
||||
|
||||
public C get() { return wrapped; }
|
||||
|
||||
@Override
|
||||
public void close() {
|
||||
try {
|
||||
cleanup.accept(wrapped);
|
||||
} catch (Throwable t) {
|
||||
throw new RuntimeException(t);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -90,7 +90,9 @@ public class GitRepositoryHandler
|
||||
private static final Object LOCK = new Object();
|
||||
|
||||
private final Scheduler scheduler;
|
||||
|
||||
|
||||
private final GitWorkdirFactory workdirFactory;
|
||||
|
||||
private Task task;
|
||||
|
||||
//~--- constructors ---------------------------------------------------------
|
||||
@@ -98,16 +100,18 @@ public class GitRepositoryHandler
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
* @param storeFactory
|
||||
*
|
||||
* @param storeFactory
|
||||
* @param fileSystem
|
||||
* @param scheduler
|
||||
* @param repositoryLocationResolver
|
||||
*/
|
||||
@Inject
|
||||
public GitRepositoryHandler(ConfigurationStoreFactory storeFactory, FileSystem fileSystem, Scheduler scheduler, RepositoryLocationResolver repositoryLocationResolver)
|
||||
public GitRepositoryHandler(ConfigurationStoreFactory storeFactory, FileSystem fileSystem, Scheduler scheduler, RepositoryLocationResolver repositoryLocationResolver, GitWorkdirFactory workdirFactory)
|
||||
{
|
||||
super(storeFactory, fileSystem, repositoryLocationResolver);
|
||||
this.scheduler = scheduler;
|
||||
this.workdirFactory = workdirFactory;
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
@@ -116,17 +120,17 @@ public class GitRepositoryHandler
|
||||
public void init(SCMContextProvider context)
|
||||
{
|
||||
super.init(context);
|
||||
scheduleGc();
|
||||
scheduleGc(getConfig().getGcExpression());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setConfig(GitConfig config)
|
||||
{
|
||||
scheduleGc(config.getGcExpression());
|
||||
super.setConfig(config);
|
||||
scheduleGc();
|
||||
}
|
||||
|
||||
private void scheduleGc()
|
||||
private void scheduleGc(String expression)
|
||||
{
|
||||
synchronized (LOCK){
|
||||
if ( task != null ){
|
||||
@@ -134,11 +138,10 @@ public class GitRepositoryHandler
|
||||
task.cancel();
|
||||
task = null;
|
||||
}
|
||||
String exp = getConfig().getGcExpression();
|
||||
if (!Strings.isNullOrEmpty(exp))
|
||||
if (!Strings.isNullOrEmpty(expression))
|
||||
{
|
||||
logger.info("schedule git gc task with expression {}", exp);
|
||||
task = scheduler.schedule(exp, GitGcTask.class);
|
||||
logger.info("schedule git gc task with expression {}", expression);
|
||||
task = scheduler.schedule(expression, GitGcTask.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -235,4 +238,8 @@ public class GitRepositoryHandler
|
||||
{
|
||||
return new File(directory, DIRECTORY_REFS).exists();
|
||||
}
|
||||
|
||||
public GitWorkdirFactory getWorkdirFactory() {
|
||||
return workdirFactory;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,7 @@ import org.eclipse.jgit.lib.ObjectId;
|
||||
import org.eclipse.jgit.lib.Ref;
|
||||
import org.eclipse.jgit.revwalk.RevCommit;
|
||||
import org.eclipse.jgit.revwalk.RevWalk;
|
||||
import org.eclipse.jgit.revwalk.filter.RevFilter;
|
||||
import org.eclipse.jgit.storage.file.FileRepositoryBuilder;
|
||||
import org.eclipse.jgit.transport.FetchResult;
|
||||
import org.eclipse.jgit.transport.RefSpec;
|
||||
@@ -55,6 +56,7 @@ import org.eclipse.jgit.treewalk.TreeWalk;
|
||||
import org.eclipse.jgit.util.FS;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import sonia.scm.ContextEntry;
|
||||
import sonia.scm.util.HttpUtil;
|
||||
import sonia.scm.util.Util;
|
||||
import sonia.scm.web.GitUserAgentProvider;
|
||||
@@ -203,7 +205,7 @@ public final class GitUtil
|
||||
}
|
||||
catch (GitAPIException ex)
|
||||
{
|
||||
throw new InternalRepositoryException("could not fetch", ex);
|
||||
throw new InternalRepositoryException(ContextEntry.ContextBuilder.entity("remote", directory.toString()).in(remoteRepository), "could not fetch", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -716,6 +718,18 @@ public final class GitUtil
|
||||
return (id != null) &&!id.equals(ObjectId.zeroId());
|
||||
}
|
||||
|
||||
/**
|
||||
* Computes the first common ancestor of two revisions, aka merge base.
|
||||
*/
|
||||
public static ObjectId computeCommonAncestor(org.eclipse.jgit.lib.Repository repository, ObjectId revision1, ObjectId revision2) throws IOException {
|
||||
try (RevWalk mergeBaseWalk = new RevWalk(repository)) {
|
||||
mergeBaseWalk.setRevFilter(RevFilter.MERGE_BASE);
|
||||
mergeBaseWalk.markStart(mergeBaseWalk.lookupCommit(revision1));
|
||||
mergeBaseWalk.markStart(mergeBaseWalk.parseCommit(revision2));
|
||||
return mergeBaseWalk.next().getId();
|
||||
}
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package sonia.scm.repository;
|
||||
|
||||
import sonia.scm.repository.spi.GitContext;
|
||||
import sonia.scm.repository.spi.WorkingCopy;
|
||||
|
||||
public interface GitWorkdirFactory {
|
||||
WorkingCopy createWorkingCopy(GitContext gitContext);
|
||||
}
|
||||
@@ -160,7 +160,7 @@ public abstract class AbstractGitIncomingOutgoingCommand
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new InternalRepositoryException("could not execute incoming command", ex);
|
||||
throw new InternalRepositoryException(repository, "could not execute incoming command", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -200,13 +200,7 @@ public abstract class AbstractGitIncomingOutgoingCommand
|
||||
{
|
||||
if (e.getKey().startsWith(prefix))
|
||||
{
|
||||
if (ref != null)
|
||||
{
|
||||
throw new InternalRepositoryException("could not find remote branch");
|
||||
}
|
||||
|
||||
ref = e.getValue();
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ public abstract class AbstractGitPushOrPullCommand extends AbstractGitCommand
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new InternalRepositoryException("could not execute push/pull command", ex);
|
||||
throw new InternalRepositoryException(repository, "could not execute push/pull command", ex);
|
||||
}
|
||||
|
||||
return counter;
|
||||
|
||||
@@ -55,6 +55,8 @@ import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static sonia.scm.ContextEntry.ContextBuilder.entity;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
@@ -108,9 +110,8 @@ public class GitBlameCommand extends AbstractGitCommand implements BlameCommand
|
||||
|
||||
if (gitBlameResult == null)
|
||||
{
|
||||
throw new InternalRepositoryException(
|
||||
"could not create blame result for path ".concat(
|
||||
request.getPath()));
|
||||
throw new InternalRepositoryException(entity("path", request.getPath()).in(repository),
|
||||
"could not create blame result for path");
|
||||
}
|
||||
|
||||
List<BlameLine> blameLines = new ArrayList<BlameLine>();
|
||||
@@ -150,7 +151,7 @@ public class GitBlameCommand extends AbstractGitCommand implements BlameCommand
|
||||
}
|
||||
catch (GitAPIException ex)
|
||||
{
|
||||
throw new InternalRepositoryException("could not create blame view", ex);
|
||||
throw new InternalRepositoryException(repository, "could not create blame view", ex);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -102,7 +102,7 @@ public class GitBranchesCommand extends AbstractGitCommand
|
||||
}
|
||||
catch (GitAPIException ex)
|
||||
{
|
||||
throw new InternalRepositoryException("could not read branches", ex);
|
||||
throw new InternalRepositoryException(repository, "could not read branches", ex);
|
||||
}
|
||||
|
||||
return branches;
|
||||
|
||||
@@ -55,9 +55,7 @@ import sonia.scm.repository.BrowserResult;
|
||||
import sonia.scm.repository.FileObject;
|
||||
import sonia.scm.repository.GitSubModuleParser;
|
||||
import sonia.scm.repository.GitUtil;
|
||||
import sonia.scm.repository.PathNotFoundException;
|
||||
import sonia.scm.repository.Repository;
|
||||
import sonia.scm.repository.RevisionNotFoundException;
|
||||
import sonia.scm.repository.SubRepository;
|
||||
import sonia.scm.util.Util;
|
||||
|
||||
@@ -104,7 +102,7 @@ public class GitBrowseCommand extends AbstractGitCommand
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public BrowserResult getBrowserResult(BrowseCommandRequest request)
|
||||
throws IOException, NotFoundException {
|
||||
throws IOException {
|
||||
logger.debug("try to create browse result for {}", request);
|
||||
|
||||
BrowserResult result;
|
||||
@@ -166,7 +164,7 @@ public class GitBrowseCommand extends AbstractGitCommand
|
||||
*/
|
||||
private FileObject createFileObject(org.eclipse.jgit.lib.Repository repo,
|
||||
BrowseCommandRequest request, ObjectId revId, TreeWalk treeWalk)
|
||||
throws IOException, RevisionNotFoundException {
|
||||
throws IOException {
|
||||
|
||||
FileObject file = new FileObject();
|
||||
|
||||
@@ -258,7 +256,7 @@ public class GitBrowseCommand extends AbstractGitCommand
|
||||
return result;
|
||||
}
|
||||
|
||||
private FileObject getEntry(org.eclipse.jgit.lib.Repository repo, BrowseCommandRequest request, ObjectId revId) throws IOException, NotFoundException {
|
||||
private FileObject getEntry(org.eclipse.jgit.lib.Repository repo, BrowseCommandRequest request, ObjectId revId) throws IOException {
|
||||
RevWalk revWalk = null;
|
||||
TreeWalk treeWalk = null;
|
||||
|
||||
@@ -309,7 +307,7 @@ public class GitBrowseCommand extends AbstractGitCommand
|
||||
return Strings.isNullOrEmpty(request.getPath()) || "/".equals(request.getPath());
|
||||
}
|
||||
|
||||
private FileObject findChildren(FileObject parent, org.eclipse.jgit.lib.Repository repo, BrowseCommandRequest request, ObjectId revId, TreeWalk treeWalk) throws IOException, NotFoundException {
|
||||
private FileObject findChildren(FileObject parent, org.eclipse.jgit.lib.Repository repo, BrowseCommandRequest request, ObjectId revId, TreeWalk treeWalk) throws IOException {
|
||||
List<FileObject> files = Lists.newArrayList();
|
||||
while (treeWalk.next())
|
||||
{
|
||||
@@ -337,7 +335,7 @@ public class GitBrowseCommand extends AbstractGitCommand
|
||||
}
|
||||
|
||||
private FileObject findFirstMatch(org.eclipse.jgit.lib.Repository repo,
|
||||
BrowseCommandRequest request, ObjectId revId, TreeWalk treeWalk) throws IOException, NotFoundException {
|
||||
BrowseCommandRequest request, ObjectId revId, TreeWalk treeWalk) throws IOException {
|
||||
String[] pathElements = request.getPath().split("/");
|
||||
int currentDepth = 0;
|
||||
int limit = pathElements.length;
|
||||
@@ -363,7 +361,7 @@ public class GitBrowseCommand extends AbstractGitCommand
|
||||
private Map<String,
|
||||
SubRepository> getSubRepositories(org.eclipse.jgit.lib.Repository repo,
|
||||
ObjectId revision)
|
||||
throws IOException, RevisionNotFoundException {
|
||||
throws IOException {
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("read submodules of {} at {}", repository.getName(),
|
||||
@@ -377,7 +375,7 @@ public class GitBrowseCommand extends AbstractGitCommand
|
||||
PATH_MODULES, baos);
|
||||
subRepositories = GitSubModuleParser.parse(baos.toString());
|
||||
}
|
||||
catch (PathNotFoundException ex)
|
||||
catch (NotFoundException ex)
|
||||
{
|
||||
logger.trace("could not find .gitmodules", ex);
|
||||
subRepositories = Collections.EMPTY_MAP;
|
||||
@@ -388,7 +386,7 @@ public class GitBrowseCommand extends AbstractGitCommand
|
||||
|
||||
private SubRepository getSubRepository(org.eclipse.jgit.lib.Repository repo,
|
||||
ObjectId revId, String path)
|
||||
throws IOException, RevisionNotFoundException {
|
||||
throws IOException {
|
||||
Map<String, SubRepository> subRepositories = subrepositoryCache.get(revId);
|
||||
|
||||
if (subRepositories == null)
|
||||
|
||||
@@ -45,8 +45,6 @@ import org.eclipse.jgit.treewalk.filter.PathFilter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import sonia.scm.repository.GitUtil;
|
||||
import sonia.scm.repository.PathNotFoundException;
|
||||
import sonia.scm.repository.RevisionNotFoundException;
|
||||
import sonia.scm.util.Util;
|
||||
|
||||
import java.io.Closeable;
|
||||
@@ -55,6 +53,9 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import static sonia.scm.ContextEntry.ContextBuilder.entity;
|
||||
import static sonia.scm.NotFoundException.notFound;
|
||||
|
||||
|
||||
public class GitCatCommand extends AbstractGitCommand implements CatCommand {
|
||||
|
||||
@@ -65,7 +66,7 @@ public class GitCatCommand extends AbstractGitCommand implements CatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getCatResult(CatCommandRequest request, OutputStream output) throws IOException, PathNotFoundException, RevisionNotFoundException {
|
||||
public void getCatResult(CatCommandRequest request, OutputStream output) throws IOException {
|
||||
logger.debug("try to read content for {}", request);
|
||||
try (ClosableObjectLoaderContainer closableObjectLoaderContainer = getLoader(request)) {
|
||||
closableObjectLoaderContainer.objectLoader.copyTo(output);
|
||||
@@ -73,24 +74,24 @@ public class GitCatCommand extends AbstractGitCommand implements CatCommand {
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getCatResultStream(CatCommandRequest request) throws IOException, PathNotFoundException, RevisionNotFoundException {
|
||||
public InputStream getCatResultStream(CatCommandRequest request) throws IOException {
|
||||
logger.debug("try to read content for {}", request);
|
||||
return new InputStreamWrapper(getLoader(request));
|
||||
}
|
||||
|
||||
void getContent(org.eclipse.jgit.lib.Repository repo, ObjectId revId, String path, OutputStream output) throws IOException, PathNotFoundException, RevisionNotFoundException {
|
||||
void getContent(org.eclipse.jgit.lib.Repository repo, ObjectId revId, String path, OutputStream output) throws IOException {
|
||||
try (ClosableObjectLoaderContainer closableObjectLoaderContainer = getLoader(repo, revId, path)) {
|
||||
closableObjectLoaderContainer.objectLoader.copyTo(output);
|
||||
}
|
||||
}
|
||||
|
||||
private ClosableObjectLoaderContainer getLoader(CatCommandRequest request) throws IOException, PathNotFoundException, RevisionNotFoundException {
|
||||
private ClosableObjectLoaderContainer getLoader(CatCommandRequest request) throws IOException {
|
||||
org.eclipse.jgit.lib.Repository repo = open();
|
||||
ObjectId revId = getCommitOrDefault(repo, request.getRevision());
|
||||
return getLoader(repo, revId, request.getPath());
|
||||
}
|
||||
|
||||
private ClosableObjectLoaderContainer getLoader(Repository repo, ObjectId revId, String path) throws IOException, PathNotFoundException, RevisionNotFoundException {
|
||||
private ClosableObjectLoaderContainer getLoader(Repository repo, ObjectId revId, String path) throws IOException {
|
||||
TreeWalk treeWalk = new TreeWalk(repo);
|
||||
treeWalk.setRecursive(Util.nonNull(path).contains("/"));
|
||||
|
||||
@@ -102,7 +103,7 @@ public class GitCatCommand extends AbstractGitCommand implements CatCommand {
|
||||
try {
|
||||
entry = revWalk.parseCommit(revId);
|
||||
} catch (MissingObjectException e) {
|
||||
throw new RevisionNotFoundException(revId.getName());
|
||||
throw notFound(entity("Revision", revId.getName()).in(repository));
|
||||
}
|
||||
RevTree revTree = entry.getTree();
|
||||
|
||||
@@ -120,7 +121,7 @@ public class GitCatCommand extends AbstractGitCommand implements CatCommand {
|
||||
|
||||
return new ClosableObjectLoaderContainer(loader, treeWalk, revWalk);
|
||||
} else {
|
||||
throw new PathNotFoundException(path);
|
||||
throw notFound(entity("Path", path).in("Revision", revId.getName()).in(repository));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import sonia.scm.repository.GitUtil;
|
||||
import sonia.scm.repository.Repository;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
@@ -65,10 +66,12 @@ public class GitContext implements Closeable
|
||||
*
|
||||
*
|
||||
* @param directory
|
||||
* @param repository
|
||||
*/
|
||||
public GitContext(File directory)
|
||||
public GitContext(File directory, Repository repository)
|
||||
{
|
||||
this.directory = directory;
|
||||
this.repository = repository;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
@@ -82,8 +85,8 @@ public class GitContext implements Closeable
|
||||
{
|
||||
logger.trace("close git repository {}", directory);
|
||||
|
||||
GitUtil.close(repository);
|
||||
repository = null;
|
||||
GitUtil.close(gitRepository);
|
||||
gitRepository = null;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -96,21 +99,30 @@ public class GitContext implements Closeable
|
||||
*/
|
||||
public org.eclipse.jgit.lib.Repository open() throws IOException
|
||||
{
|
||||
if (repository == null)
|
||||
if (gitRepository == null)
|
||||
{
|
||||
logger.trace("open git repository {}", directory);
|
||||
|
||||
repository = GitUtil.open(directory);
|
||||
gitRepository = GitUtil.open(directory);
|
||||
}
|
||||
|
||||
return gitRepository;
|
||||
}
|
||||
|
||||
Repository getRepository() {
|
||||
return repository;
|
||||
}
|
||||
|
||||
File getDirectory() {
|
||||
return directory;
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private final File directory;
|
||||
private final Repository repository;
|
||||
|
||||
/** Field description */
|
||||
private org.eclipse.jgit.lib.Repository repository;
|
||||
private org.eclipse.jgit.lib.Repository gitRepository;
|
||||
}
|
||||
|
||||
@@ -34,27 +34,25 @@ package sonia.scm.repository.spi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import org.eclipse.jgit.diff.DiffEntry;
|
||||
import org.eclipse.jgit.diff.DiffFormatter;
|
||||
import org.eclipse.jgit.lib.ObjectId;
|
||||
import org.eclipse.jgit.revwalk.RevCommit;
|
||||
import org.eclipse.jgit.revwalk.RevTree;
|
||||
import org.eclipse.jgit.revwalk.RevWalk;
|
||||
import org.eclipse.jgit.treewalk.EmptyTreeIterator;
|
||||
import org.eclipse.jgit.treewalk.TreeWalk;
|
||||
import org.eclipse.jgit.treewalk.filter.PathFilter;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import sonia.scm.repository.GitUtil;
|
||||
import sonia.scm.repository.Repository;
|
||||
import sonia.scm.util.Util;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.BufferedOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -107,7 +105,8 @@ public class GitDiffCommand extends AbstractGitCommand implements DiffCommand
|
||||
|
||||
walk = new RevWalk(gr);
|
||||
|
||||
RevCommit commit = walk.parseCommit(gr.resolve(request.getRevision()));
|
||||
ObjectId revision = gr.resolve(request.getRevision());
|
||||
RevCommit commit = walk.parseCommit(revision);
|
||||
|
||||
walk.markStart(commit);
|
||||
commit = walk.next();
|
||||
@@ -120,7 +119,15 @@ public class GitDiffCommand extends AbstractGitCommand implements DiffCommand
|
||||
treeWalk.setFilter(PathFilter.create(request.getPath()));
|
||||
}
|
||||
|
||||
if (commit.getParentCount() > 0)
|
||||
|
||||
if (!Strings.isNullOrEmpty(request.getAncestorChangeset()))
|
||||
{
|
||||
ObjectId otherRevision = gr.resolve(request.getAncestorChangeset());
|
||||
ObjectId ancestorId = computeCommonAncestor(gr, revision, otherRevision);
|
||||
RevTree tree = walk.parseCommit(ancestorId).getTree();
|
||||
treeWalk.addTree(tree);
|
||||
}
|
||||
else if (commit.getParentCount() > 0)
|
||||
{
|
||||
RevTree tree = commit.getParent(0).getTree();
|
||||
|
||||
@@ -156,7 +163,6 @@ public class GitDiffCommand extends AbstractGitCommand implements DiffCommand
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
// TODO throw exception
|
||||
logger.error("could not create diff", ex);
|
||||
}
|
||||
@@ -167,4 +173,9 @@ public class GitDiffCommand extends AbstractGitCommand implements DiffCommand
|
||||
GitUtil.release(formatter);
|
||||
}
|
||||
}
|
||||
|
||||
private ObjectId computeCommonAncestor(org.eclipse.jgit.lib.Repository repository, ObjectId revision1, ObjectId revision2) throws IOException {
|
||||
return GitUtil.computeCommonAncestor(repository, revision1, revision2);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -43,6 +43,7 @@ import org.eclipse.jgit.lib.Ref;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
import org.eclipse.jgit.revwalk.RevCommit;
|
||||
import org.eclipse.jgit.revwalk.RevWalk;
|
||||
import org.eclipse.jgit.revwalk.filter.RevFilter;
|
||||
import org.eclipse.jgit.treewalk.filter.AndTreeFilter;
|
||||
import org.eclipse.jgit.treewalk.filter.PathFilter;
|
||||
import org.eclipse.jgit.treewalk.filter.TreeFilter;
|
||||
@@ -53,7 +54,6 @@ import sonia.scm.repository.ChangesetPagingResult;
|
||||
import sonia.scm.repository.GitChangesetConverter;
|
||||
import sonia.scm.repository.GitUtil;
|
||||
import sonia.scm.repository.InternalRepositoryException;
|
||||
import sonia.scm.repository.RevisionNotFoundException;
|
||||
import sonia.scm.util.IOUtil;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -61,6 +61,9 @@ import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import static sonia.scm.ContextEntry.ContextBuilder.entity;
|
||||
import static sonia.scm.NotFoundException.notFound;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
@@ -85,7 +88,6 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
|
||||
*
|
||||
* @param context
|
||||
* @param repository
|
||||
* @param repositoryDirectory
|
||||
*/
|
||||
GitLogCommand(GitContext context, sonia.scm.repository.Repository repository)
|
||||
{
|
||||
@@ -162,7 +164,7 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public ChangesetPagingResult getChangesets(LogCommandRequest request) throws RevisionNotFoundException {
|
||||
public ChangesetPagingResult getChangesets(LogCommandRequest request) {
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("fetch changesets for request: {}", request);
|
||||
}
|
||||
@@ -198,6 +200,14 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
|
||||
endId = repository.resolve(request.getEndChangeset());
|
||||
}
|
||||
|
||||
Ref branch = getBranchOrDefault(repository,request.getBranch());
|
||||
|
||||
ObjectId ancestorId = null;
|
||||
|
||||
if (!Strings.isNullOrEmpty(request.getAncestorChangeset())) {
|
||||
ancestorId = computeCommonAncestor(request, repository, startId, branch);
|
||||
}
|
||||
|
||||
revWalk = new RevWalk(repository);
|
||||
|
||||
converter = new GitChangesetConverter(repository, revWalk);
|
||||
@@ -208,8 +218,6 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
|
||||
PathFilter.create(request.getPath()), TreeFilter.ANY_DIFF));
|
||||
}
|
||||
|
||||
Ref branch = getBranchOrDefault(repository,request.getBranch());
|
||||
|
||||
if (branch != null) {
|
||||
if (startId != null) {
|
||||
revWalk.markStart(revWalk.lookupCommit(startId));
|
||||
@@ -217,11 +225,16 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
|
||||
revWalk.markStart(revWalk.lookupCommit(branch.getObjectId()));
|
||||
}
|
||||
|
||||
|
||||
Iterator<RevCommit> iterator = revWalk.iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
RevCommit commit = iterator.next();
|
||||
|
||||
if (commit.getId().equals(ancestorId)) {
|
||||
break;
|
||||
}
|
||||
|
||||
if ((counter >= start)
|
||||
&& ((limit < 0) || (counter < start + limit))) {
|
||||
changesetList.add(converter.createChangeset(commit));
|
||||
@@ -229,7 +242,7 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
|
||||
|
||||
counter++;
|
||||
|
||||
if ((endId != null) && commit.getId().equals(endId)) {
|
||||
if (commit.getId().equals(endId)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -249,11 +262,11 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
|
||||
}
|
||||
catch (MissingObjectException e)
|
||||
{
|
||||
throw new RevisionNotFoundException(e.getObjectId().name());
|
||||
throw notFound(entity("Revision", e.getObjectId().getName()).in(repository));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
throw new InternalRepositoryException("could not create change log", ex);
|
||||
throw new InternalRepositoryException(repository, "could not create change log", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
@@ -263,4 +276,17 @@ public class GitLogCommand extends AbstractGitCommand implements LogCommand
|
||||
|
||||
return changesets;
|
||||
}
|
||||
|
||||
private ObjectId computeCommonAncestor(LogCommandRequest request, Repository repository, ObjectId startId, Ref branch) throws IOException {
|
||||
try (RevWalk mergeBaseWalk = new RevWalk(repository)) {
|
||||
mergeBaseWalk.setRevFilter(RevFilter.MERGE_BASE);
|
||||
if (startId != null) {
|
||||
mergeBaseWalk.markStart(mergeBaseWalk.lookupCommit(startId));
|
||||
} else {
|
||||
mergeBaseWalk.markStart(mergeBaseWalk.lookupCommit(branch.getObjectId()));
|
||||
}
|
||||
mergeBaseWalk.markStart(mergeBaseWalk.parseCommit(repository.resolve(request.getAncestorChangeset())));
|
||||
return mergeBaseWalk.next().getId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,169 @@
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.eclipse.jgit.api.Git;
|
||||
import org.eclipse.jgit.api.MergeResult;
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
import org.eclipse.jgit.lib.ObjectId;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
import org.eclipse.jgit.merge.MergeStrategy;
|
||||
import org.eclipse.jgit.merge.ResolveMerger;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import sonia.scm.repository.GitWorkdirFactory;
|
||||
import sonia.scm.repository.InternalRepositoryException;
|
||||
import sonia.scm.repository.Person;
|
||||
import sonia.scm.repository.api.MergeCommandResult;
|
||||
import sonia.scm.repository.api.MergeDryRunCommandResult;
|
||||
import sonia.scm.user.User;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.MessageFormat;
|
||||
|
||||
public class GitMergeCommand extends AbstractGitCommand implements MergeCommand {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(GitMergeCommand.class);
|
||||
|
||||
private static final String MERGE_COMMIT_MESSAGE_TEMPLATE = String.join("\n",
|
||||
"Merge of branch {0} into {1}",
|
||||
"",
|
||||
"Automatic merge by SCM-Manager.");
|
||||
|
||||
private final GitWorkdirFactory workdirFactory;
|
||||
|
||||
GitMergeCommand(GitContext context, sonia.scm.repository.Repository repository, GitWorkdirFactory workdirFactory) {
|
||||
super(context, repository);
|
||||
this.workdirFactory = workdirFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MergeCommandResult merge(MergeCommandRequest request) {
|
||||
try (WorkingCopy workingCopy = workdirFactory.createWorkingCopy(context)) {
|
||||
Repository repository = workingCopy.get();
|
||||
logger.debug("cloned repository to folder {}", repository.getWorkTree());
|
||||
return new MergeWorker(repository, request).merge();
|
||||
} catch (IOException e) {
|
||||
throw new InternalRepositoryException(context.getRepository(), "could not clone repository for merge", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MergeDryRunCommandResult dryRun(MergeCommandRequest request) {
|
||||
try {
|
||||
Repository repository = context.open();
|
||||
ResolveMerger merger = (ResolveMerger) MergeStrategy.RECURSIVE.newMerger(repository, true);
|
||||
return new MergeDryRunCommandResult(merger.merge(repository.resolve(request.getBranchToMerge()), repository.resolve(request.getTargetBranch())));
|
||||
} catch (IOException e) {
|
||||
throw new InternalRepositoryException(context.getRepository(), "could not clone repository for merge", e);
|
||||
}
|
||||
}
|
||||
|
||||
private class MergeWorker {
|
||||
|
||||
private final String target;
|
||||
private final String toMerge;
|
||||
private final Person author;
|
||||
private final Git clone;
|
||||
private final String messageTemplate;
|
||||
|
||||
private MergeWorker(Repository clone, MergeCommandRequest request) {
|
||||
this.target = request.getTargetBranch();
|
||||
this.toMerge = request.getBranchToMerge();
|
||||
this.author = request.getAuthor();
|
||||
this.messageTemplate = request.getMessageTemplate();
|
||||
this.clone = new Git(clone);
|
||||
}
|
||||
|
||||
private MergeCommandResult merge() throws IOException {
|
||||
checkOutTargetBranch();
|
||||
MergeResult result = doMergeInClone();
|
||||
if (result.getMergeStatus().isSuccessful()) {
|
||||
doCommit();
|
||||
push();
|
||||
return MergeCommandResult.success();
|
||||
} else {
|
||||
return analyseFailure(result);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkOutTargetBranch() {
|
||||
try {
|
||||
clone.checkout().setName(target).call();
|
||||
} catch (GitAPIException e) {
|
||||
throw new InternalRepositoryException(context.getRepository(), "could not checkout target branch for merge: " + target, e);
|
||||
}
|
||||
}
|
||||
|
||||
private MergeResult doMergeInClone() throws IOException {
|
||||
MergeResult result;
|
||||
try {
|
||||
result = clone.merge()
|
||||
.setCommit(false) // we want to set the author manually
|
||||
.include(toMerge, resolveRevision(toMerge))
|
||||
.call();
|
||||
} catch (GitAPIException e) {
|
||||
throw new InternalRepositoryException(context.getRepository(), "could not merge branch " + toMerge + " into " + target, e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void doCommit() {
|
||||
logger.debug("merged branch {} into {}", toMerge, target);
|
||||
Person authorToUse = determineAuthor();
|
||||
try {
|
||||
clone.commit()
|
||||
.setAuthor(authorToUse.getName(), authorToUse.getMail())
|
||||
.setMessage(MessageFormat.format(determineMessageTemplate(), toMerge, target))
|
||||
.call();
|
||||
} catch (GitAPIException e) {
|
||||
throw new InternalRepositoryException(context.getRepository(), "could not commit merge between branch " + toMerge + " and " + target, e);
|
||||
}
|
||||
}
|
||||
|
||||
private String determineMessageTemplate() {
|
||||
if (Strings.isNullOrEmpty(messageTemplate)) {
|
||||
return MERGE_COMMIT_MESSAGE_TEMPLATE;
|
||||
} else {
|
||||
return messageTemplate;
|
||||
}
|
||||
}
|
||||
|
||||
private Person determineAuthor() {
|
||||
if (author == null) {
|
||||
Subject subject = SecurityUtils.getSubject();
|
||||
User user = subject.getPrincipals().oneByType(User.class);
|
||||
String name = user.getDisplayName();
|
||||
String email = user.getMail();
|
||||
logger.debug("no author set; using logged in user: {} <{}>", name, email);
|
||||
return new Person(name, email);
|
||||
} else {
|
||||
return author;
|
||||
}
|
||||
}
|
||||
|
||||
private void push() {
|
||||
try {
|
||||
clone.push().call();
|
||||
} catch (GitAPIException e) {
|
||||
throw new InternalRepositoryException(context.getRepository(), "could not push merged branch " + toMerge + " to origin", e);
|
||||
}
|
||||
logger.debug("pushed merged branch {}", target);
|
||||
}
|
||||
|
||||
private MergeCommandResult analyseFailure(MergeResult result) {
|
||||
logger.info("could not merged branch {} into {} due to conflict in paths {}", toMerge, target, result.getConflicts().keySet());
|
||||
return MergeCommandResult.failure(result.getConflicts().keySet());
|
||||
}
|
||||
|
||||
private ObjectId resolveRevision(String branchToMerge) throws IOException {
|
||||
ObjectId resolved = clone.getRepository().resolve(branchToMerge);
|
||||
if (resolved == null) {
|
||||
return clone.getRepository().resolve("origin/" + branchToMerge);
|
||||
} else {
|
||||
return resolved;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -17,6 +17,8 @@ import java.io.IOException;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.List;
|
||||
|
||||
import static sonia.scm.ContextEntry.ContextBuilder.entity;
|
||||
|
||||
|
||||
@Slf4j
|
||||
public class GitModificationsCommand extends AbstractGitCommand implements ModificationsCommand {
|
||||
@@ -26,7 +28,7 @@ public class GitModificationsCommand extends AbstractGitCommand implements Modif
|
||||
}
|
||||
|
||||
private Modifications createModifications(TreeWalk treeWalk, RevCommit commit, RevWalk revWalk, String revision)
|
||||
throws IOException, UnsupportedModificationTypeException {
|
||||
throws IOException {
|
||||
treeWalk.reset();
|
||||
treeWalk.setRecursive(true);
|
||||
if (commit.getParentCount() > 0) {
|
||||
@@ -73,12 +75,7 @@ public class GitModificationsCommand extends AbstractGitCommand implements Modif
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
log.error("could not open repository", ex);
|
||||
throw new InternalRepositoryException(ex);
|
||||
|
||||
} catch (UnsupportedModificationTypeException ex) {
|
||||
log.error("Unsupported modification type", ex);
|
||||
throw new InternalRepositoryException(ex);
|
||||
|
||||
throw new InternalRepositoryException(entity(repository), "could not open repository", ex);
|
||||
} finally {
|
||||
GitUtil.release(revWalk);
|
||||
GitUtil.close(gitRepository);
|
||||
@@ -100,7 +97,7 @@ public class GitModificationsCommand extends AbstractGitCommand implements Modif
|
||||
} else if (type == DiffEntry.ChangeType.DELETE) {
|
||||
modifications.getRemoved().add(entry.getOldPath());
|
||||
} else {
|
||||
throw new UnsupportedModificationTypeException(MessageFormat.format("The modification type: {0} is not supported.", type));
|
||||
throw new UnsupportedModificationTypeException(entity(repository), MessageFormat.format("The modification type: {0} is not supported.", type));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,7 +77,6 @@ public class GitOutgoingCommand extends AbstractGitIncomingOutgoingCommand
|
||||
* @return
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Override
|
||||
public ChangesetPagingResult getOutgoingChangesets(
|
||||
|
||||
@@ -101,7 +101,6 @@ public class GitPullCommand extends AbstractGitPushOrPullCommand
|
||||
* @return
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Override
|
||||
public PullResponse pull(PullCommandRequest request)
|
||||
@@ -249,7 +248,7 @@ public class GitPullCommand extends AbstractGitPushOrPullCommand
|
||||
}
|
||||
catch (GitAPIException ex)
|
||||
{
|
||||
throw new InternalRepositoryException("error durring pull", ex);
|
||||
throw new InternalRepositoryException(repository, "error during pull", ex);
|
||||
}
|
||||
|
||||
return response;
|
||||
|
||||
@@ -85,7 +85,6 @@ public class GitPushCommand extends AbstractGitPushOrPullCommand
|
||||
* @return
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Override
|
||||
public PushResponse push(PushCommandRequest request)
|
||||
|
||||
@@ -63,7 +63,8 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider
|
||||
Command.INCOMING,
|
||||
Command.OUTGOING,
|
||||
Command.PUSH,
|
||||
Command.PULL
|
||||
Command.PULL,
|
||||
Command.MERGE
|
||||
);
|
||||
//J+
|
||||
|
||||
@@ -72,7 +73,7 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider
|
||||
public GitRepositoryServiceProvider(GitRepositoryHandler handler, Repository repository) {
|
||||
this.handler = handler;
|
||||
this.repository = repository;
|
||||
this.context = new GitContext(handler.getDirectory(repository));
|
||||
this.context = new GitContext(handler.getDirectory(repository), repository);
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
@@ -240,7 +241,12 @@ public class GitRepositoryServiceProvider extends RepositoryServiceProvider
|
||||
return new GitTagsCommand(context, repository);
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
@Override
|
||||
public MergeCommand getMergeCommand() {
|
||||
return new GitMergeCommand(context, repository, handler.getWorkdirFactory());
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private GitContext context;
|
||||
|
||||
@@ -95,7 +95,7 @@ public class GitTagsCommand extends AbstractGitCommand implements TagsCommand
|
||||
}
|
||||
catch (GitAPIException ex)
|
||||
{
|
||||
throw new InternalRepositoryException("could not read tags from repository", ex);
|
||||
throw new InternalRepositoryException(repository, "could not read tags from repository", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
import org.eclipse.jgit.api.Git;
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
import org.eclipse.jgit.util.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import sonia.scm.repository.GitWorkdirFactory;
|
||||
import sonia.scm.repository.InternalRepositoryException;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
|
||||
public class SimpleGitWorkdirFactory implements GitWorkdirFactory {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(SimpleGitWorkdirFactory.class);
|
||||
|
||||
private final File poolDirectory;
|
||||
|
||||
public SimpleGitWorkdirFactory() {
|
||||
this(new File(System.getProperty("java.io.tmpdir"), "scmm-git-pool"));
|
||||
}
|
||||
|
||||
public SimpleGitWorkdirFactory(File poolDirectory) {
|
||||
this.poolDirectory = poolDirectory;
|
||||
poolDirectory.mkdirs();
|
||||
}
|
||||
|
||||
public WorkingCopy createWorkingCopy(GitContext gitContext) {
|
||||
try {
|
||||
Repository clone = cloneRepository(gitContext.getDirectory(), createNewWorkdir());
|
||||
return new WorkingCopy(clone, this::close);
|
||||
} catch (GitAPIException e) {
|
||||
throw new InternalRepositoryException(gitContext.getRepository(), "could not clone working copy of repository", e);
|
||||
} catch (IOException e) {
|
||||
throw new InternalRepositoryException(gitContext.getRepository(), "could not create temporary directory for clone of repository", e);
|
||||
}
|
||||
}
|
||||
|
||||
private File createNewWorkdir() throws IOException {
|
||||
return Files.createTempDirectory(poolDirectory.toPath(),"workdir").toFile();
|
||||
}
|
||||
|
||||
protected Repository cloneRepository(File bareRepository, File target) throws GitAPIException {
|
||||
return Git.cloneRepository()
|
||||
.setURI(bareRepository.getAbsolutePath())
|
||||
.setDirectory(target)
|
||||
.call()
|
||||
.getRepository();
|
||||
}
|
||||
|
||||
private void close(Repository repository) {
|
||||
repository.close();
|
||||
try {
|
||||
FileUtils.delete(repository.getWorkTree(), FileUtils.RECURSIVE);
|
||||
} catch (IOException e) {
|
||||
logger.warn("could not delete temporary git workdir '{}'", repository.getWorkTree(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,10 @@
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
import sonia.scm.ContextEntry;
|
||||
import sonia.scm.repository.InternalRepositoryException;
|
||||
|
||||
public class UnsupportedModificationTypeException extends InternalRepositoryException {
|
||||
public UnsupportedModificationTypeException(String message) {
|
||||
super(message);
|
||||
public UnsupportedModificationTypeException(ContextEntry.ContextBuilder entity, String message) {
|
||||
super(entity, message);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
import sonia.scm.repository.CloseableWrapper;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class WorkingCopy extends CloseableWrapper<Repository> {
|
||||
WorkingCopy(Repository wrapped, Consumer<Repository> cleanup) {
|
||||
super(wrapped, cleanup);
|
||||
}
|
||||
}
|
||||
@@ -151,7 +151,6 @@ public class GitRepositoryViewer
|
||||
* @return
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
private BranchesModel createBranchesModel(Repository repository)
|
||||
throws IOException
|
||||
|
||||
@@ -41,6 +41,8 @@ import org.mapstruct.factory.Mappers;
|
||||
import sonia.scm.api.v2.resources.GitConfigDtoToGitConfigMapper;
|
||||
import sonia.scm.api.v2.resources.GitConfigToGitConfigDtoMapper;
|
||||
import sonia.scm.plugin.Extension;
|
||||
import sonia.scm.repository.GitWorkdirFactory;
|
||||
import sonia.scm.repository.spi.SimpleGitWorkdirFactory;
|
||||
import sonia.scm.web.lfs.LfsBlobStoreFactory;
|
||||
|
||||
/**
|
||||
@@ -63,5 +65,7 @@ public class GitServletModule extends ServletModule
|
||||
|
||||
bind(GitConfigDtoToGitConfigMapper.class).to(Mappers.getMapper(GitConfigDtoToGitConfigMapper.class).getClass());
|
||||
bind(GitConfigToGitConfigDtoMapper.class).to(Mappers.getMapper(GitConfigToGitConfigDtoMapper.class).getClass());
|
||||
|
||||
bind(GitWorkdirFactory.class).to(SimpleGitWorkdirFactory.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
//@flow
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import type { Links } from "@scm-manager/ui-types";
|
||||
|
||||
import { InputField, Checkbox } from "@scm-manager/ui-components";
|
||||
|
||||
type Configuration = {
|
||||
repositoryDirectory?: string,
|
||||
gcExpression?: string,
|
||||
disabled: boolean,
|
||||
_links: Links
|
||||
}
|
||||
|
||||
type Props = {
|
||||
initialConfiguration: Configuration,
|
||||
readOnly: boolean,
|
||||
|
||||
onConfigurationChange: (Configuration, boolean) => void,
|
||||
|
||||
// context props
|
||||
t: (string) => string
|
||||
}
|
||||
|
||||
type State = Configuration & {
|
||||
|
||||
}
|
||||
|
||||
class GitConfigurationForm extends React.Component<Props, State> {
|
||||
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
this.state = { ...props.initialConfiguration };
|
||||
}
|
||||
|
||||
isValid = () => {
|
||||
return !!this.state.repositoryDirectory;
|
||||
};
|
||||
|
||||
handleChange = (value: any, name: string) => {
|
||||
this.setState({
|
||||
[name]: value
|
||||
}, () => this.props.onConfigurationChange(this.state, this.isValid()));
|
||||
};
|
||||
|
||||
render() {
|
||||
const { repositoryDirectory, gcExpression, disabled } = this.state;
|
||||
const { readOnly, t } = this.props;
|
||||
|
||||
return (
|
||||
<>
|
||||
<InputField name="repositoryDirectory"
|
||||
label={t("scm-git-plugin.config.directory")}
|
||||
helpText={t("scm-git-plugin.config.directoryHelpText")}
|
||||
value={repositoryDirectory}
|
||||
onChange={this.handleChange}
|
||||
disabled={readOnly}
|
||||
/>
|
||||
<InputField name="gcExpression"
|
||||
label={t("scm-git-plugin.config.gcExpression")}
|
||||
helpText={t("scm-git-plugin.config.gcExpressionHelpText")}
|
||||
value={gcExpression}
|
||||
onChange={this.handleChange}
|
||||
disabled={readOnly}
|
||||
/>
|
||||
<Checkbox name="disabled"
|
||||
label={t("scm-git-plugin.config.disabled")}
|
||||
helpText={t("scm-git-plugin.config.disabledHelpText")}
|
||||
checked={disabled}
|
||||
onChange={this.handleChange}
|
||||
disabled={readOnly}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default translate("plugins")(GitConfigurationForm);
|
||||
@@ -0,0 +1,32 @@
|
||||
//@flow
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { Title, GlobalConfiguration } from "@scm-manager/ui-components";
|
||||
import GitConfigurationForm from "./GitConfigurationForm";
|
||||
|
||||
type Props = {
|
||||
link: string,
|
||||
|
||||
t: (string) => string
|
||||
};
|
||||
|
||||
class GitGlobalConfiguration extends React.Component<Props> {
|
||||
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
}
|
||||
|
||||
render() {
|
||||
const { link, t } = this.props;
|
||||
|
||||
return (
|
||||
<div>
|
||||
<Title title={t("scm-git-plugin.config.title")}/>
|
||||
<GlobalConfiguration link={link} render={props => <GitConfigurationForm {...props} />}/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default translate("plugins")(GitGlobalConfiguration);
|
||||
@@ -3,9 +3,18 @@ import { binder } from "@scm-manager/ui-extensions";
|
||||
import ProtocolInformation from "./ProtocolInformation";
|
||||
import GitAvatar from "./GitAvatar";
|
||||
|
||||
import { ConfigurationBinder as cfgBinder } from "@scm-manager/ui-components";
|
||||
import GitGlobalConfiguration from "./GitGlobalConfiguration";
|
||||
|
||||
// repository
|
||||
|
||||
const gitPredicate = (props: Object) => {
|
||||
return props.repository && props.repository.type === "git";
|
||||
};
|
||||
|
||||
binder.bind("repos.repository-details.information", ProtocolInformation, gitPredicate);
|
||||
binder.bind("repos.repository-avatar", GitAvatar, gitPredicate);
|
||||
|
||||
// global config
|
||||
|
||||
cfgBinder.bindGlobal("/git", "scm-git-plugin.config.link", "gitConfig", GitGlobalConfiguration);
|
||||
|
||||
@@ -4,6 +4,17 @@
|
||||
"clone" : "Clone the repository",
|
||||
"create" : "Create a new repository",
|
||||
"replace" : "Push an existing repository"
|
||||
},
|
||||
"config": {
|
||||
"link": "Git",
|
||||
"title": "Git Configuration",
|
||||
"directory": "Repository Directory",
|
||||
"directoryHelpText": "Location of the Git repositories.",
|
||||
"gcExpression": "GC Cron Expression",
|
||||
"gcExpressionHelpText": "Use Quartz Cron Expressions (SECOND MINUTE HOUR DAYOFMONTH MONTH DAYOFWEEK) to run git gc in intervals.",
|
||||
"disabled": "Disabled",
|
||||
"disabledHelpText": "Enable or disable the Git plugin",
|
||||
"submit": "Submit"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package sonia.scm.repository;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
public class CloseableWrapperTest {
|
||||
|
||||
@Test
|
||||
public void shouldExecuteGivenMethodAtClose() {
|
||||
Consumer<String> wrapped = new Consumer<String>() {
|
||||
// no this cannot be replaced with a lambda because otherwise we could not use Mockito#spy
|
||||
@Override
|
||||
public void accept(String s) {
|
||||
}
|
||||
};
|
||||
|
||||
Consumer<String> closer = spy(wrapped);
|
||||
|
||||
try (CloseableWrapper<String> wrapper = new CloseableWrapper<>("test", closer)) {
|
||||
// nothing to do here
|
||||
}
|
||||
|
||||
verify(closer).accept("test");
|
||||
}
|
||||
}
|
||||
@@ -65,6 +65,9 @@ public class GitRepositoryHandlerTest extends SimpleRepositoryHandlerTestBase {
|
||||
@Mock
|
||||
private ConfigurationStoreFactory factory;
|
||||
|
||||
@Mock
|
||||
private GitWorkdirFactory gitWorkdirFactory;
|
||||
|
||||
RepositoryLocationResolver repositoryLocationResolver ;
|
||||
private Path repoDir;
|
||||
|
||||
@@ -95,7 +98,7 @@ public class GitRepositoryHandlerTest extends SimpleRepositoryHandlerTestBase {
|
||||
InitialRepositoryLocationResolver initialRepositoryLocationResolver = new InitialRepositoryLocationResolver(contextProvider,fileSystem);
|
||||
repositoryLocationResolver = new RepositoryLocationResolver(repoDao, initialRepositoryLocationResolver);
|
||||
GitRepositoryHandler repositoryHandler = new GitRepositoryHandler(factory,
|
||||
fileSystem, scheduler, repositoryLocationResolver);
|
||||
fileSystem, scheduler, repositoryLocationResolver, gitWorkdirFactory);
|
||||
|
||||
repoDir = directory.toPath();
|
||||
when(repoDao.getPath(any())).thenReturn(repoDir);
|
||||
@@ -112,7 +115,7 @@ public class GitRepositoryHandlerTest extends SimpleRepositoryHandlerTestBase {
|
||||
@Test
|
||||
public void getDirectory() {
|
||||
GitRepositoryHandler repositoryHandler = new GitRepositoryHandler(factory,
|
||||
new DefaultFileSystem(), scheduler, repositoryLocationResolver);
|
||||
new DefaultFileSystem(), scheduler, repositoryLocationResolver, gitWorkdirFactory);
|
||||
Repository repository = new Repository("id", "git", "Space", "Name");
|
||||
|
||||
GitConfig config = new GitConfig();
|
||||
|
||||
@@ -50,7 +50,9 @@ public class AbstractGitCommandTestBase extends ZippedRepositoryTestBase
|
||||
@After
|
||||
public void close()
|
||||
{
|
||||
context.close();
|
||||
if (context != null) {
|
||||
context.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,7 +65,7 @@ public class AbstractGitCommandTestBase extends ZippedRepositoryTestBase
|
||||
{
|
||||
if (context == null)
|
||||
{
|
||||
context = new GitContext(repositoryDirectory);
|
||||
context = new GitContext(repositoryDirectory, repository);
|
||||
}
|
||||
|
||||
return context;
|
||||
|
||||
@@ -85,7 +85,6 @@ public class GitBlameCommandTest extends AbstractGitCommandTestBase
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testGetBlameResult() throws IOException
|
||||
@@ -119,7 +118,6 @@ public class GitBlameCommandTest extends AbstractGitCommandTestBase
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testGetBlameResultWithRevision()
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
import org.junit.Test;
|
||||
import sonia.scm.NotFoundException;
|
||||
import sonia.scm.repository.BrowserResult;
|
||||
import sonia.scm.repository.FileObject;
|
||||
import sonia.scm.repository.GitConstants;
|
||||
@@ -54,7 +53,7 @@ import static org.junit.Assert.assertTrue;
|
||||
public class GitBrowseCommandTest extends AbstractGitCommandTestBase {
|
||||
|
||||
@Test
|
||||
public void testGetFile() throws IOException, NotFoundException {
|
||||
public void testDefaultBranch() throws IOException {
|
||||
BrowseCommandRequest request = new BrowseCommandRequest();
|
||||
request.setPath("a.txt");
|
||||
BrowserResult result = createCommand().getBrowserResult(request);
|
||||
@@ -63,7 +62,7 @@ public class GitBrowseCommandTest extends AbstractGitCommandTestBase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDefaultDefaultBranch() throws IOException, NotFoundException {
|
||||
public void testDefaultDefaultBranch() throws IOException {
|
||||
// without default branch, the repository head should be used
|
||||
FileObject root = createCommand().getBrowserResult(new BrowseCommandRequest()).getFile();
|
||||
assertNotNull(root);
|
||||
@@ -78,7 +77,7 @@ public class GitBrowseCommandTest extends AbstractGitCommandTestBase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExplicitDefaultBranch() throws IOException, NotFoundException {
|
||||
public void testExplicitDefaultBranch() throws IOException {
|
||||
repository.setProperty(GitConstants.PROPERTY_DEFAULT_BRANCH, "test-branch");
|
||||
|
||||
FileObject root = createCommand().getBrowserResult(new BrowseCommandRequest()).getFile();
|
||||
@@ -91,7 +90,7 @@ public class GitBrowseCommandTest extends AbstractGitCommandTestBase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBrowse() throws IOException, NotFoundException {
|
||||
public void testBrowse() throws IOException {
|
||||
FileObject root = createCommand().getBrowserResult(new BrowseCommandRequest()).getFile();
|
||||
assertNotNull(root);
|
||||
|
||||
@@ -113,7 +112,7 @@ public class GitBrowseCommandTest extends AbstractGitCommandTestBase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBrowseSubDirectory() throws IOException, NotFoundException {
|
||||
public void testBrowseSubDirectory() throws IOException {
|
||||
BrowseCommandRequest request = new BrowseCommandRequest();
|
||||
|
||||
request.setPath("c");
|
||||
@@ -143,7 +142,7 @@ public class GitBrowseCommandTest extends AbstractGitCommandTestBase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRecursive() throws IOException, NotFoundException {
|
||||
public void testRecusive() throws IOException {
|
||||
BrowseCommandRequest request = new BrowseCommandRequest();
|
||||
|
||||
request.setRecursive(true);
|
||||
|
||||
@@ -32,10 +32,13 @@
|
||||
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
import org.hamcrest.BaseMatcher;
|
||||
import org.hamcrest.Description;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import sonia.scm.NotFoundException;
|
||||
import sonia.scm.repository.GitConstants;
|
||||
import sonia.scm.repository.PathNotFoundException;
|
||||
import sonia.scm.repository.RevisionNotFoundException;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -51,9 +54,12 @@ import static org.junit.Assert.assertEquals;
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class GitCatCommandTest extends AbstractGitCommandTestBase {
|
||||
|
||||
|
||||
@Rule
|
||||
public final ExpectedException expectedException = ExpectedException.none();
|
||||
|
||||
@Test
|
||||
public void testDefaultBranch() throws IOException, PathNotFoundException, RevisionNotFoundException {
|
||||
public void testDefaultBranch() throws IOException {
|
||||
// without default branch, the repository head should be used
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
request.setPath("a.txt");
|
||||
@@ -66,7 +72,7 @@ public class GitCatCommandTest extends AbstractGitCommandTestBase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCat() throws IOException, PathNotFoundException, RevisionNotFoundException {
|
||||
public void testCat() throws IOException {
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
|
||||
request.setPath("a.txt");
|
||||
@@ -75,32 +81,58 @@ public class GitCatCommandTest extends AbstractGitCommandTestBase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleCat() throws IOException, PathNotFoundException, RevisionNotFoundException {
|
||||
public void testSimpleCat() throws IOException {
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
|
||||
request.setPath("b.txt");
|
||||
assertEquals("b", execute(request));
|
||||
}
|
||||
|
||||
@Test(expected = PathNotFoundException.class)
|
||||
public void testUnknownFile() throws IOException, PathNotFoundException, RevisionNotFoundException {
|
||||
@Test
|
||||
public void testUnknownFile() throws IOException {
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
|
||||
request.setPath("unknown");
|
||||
execute(request);
|
||||
}
|
||||
|
||||
@Test(expected = RevisionNotFoundException.class)
|
||||
public void testUnknownRevision() throws IOException, PathNotFoundException, RevisionNotFoundException {
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
expectedException.expect(new BaseMatcher<Object>() {
|
||||
@Override
|
||||
public void describeTo(Description description) {
|
||||
description.appendText("expected NotFoundException for path");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Object item) {
|
||||
return "Path".equals(((NotFoundException)item).getContext().get(0).getType());
|
||||
}
|
||||
});
|
||||
|
||||
request.setRevision("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
request.setPath("a.txt");
|
||||
execute(request);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleStream() throws IOException, PathNotFoundException, RevisionNotFoundException {
|
||||
public void testUnknownRevision() throws IOException {
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
|
||||
request.setRevision("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa");
|
||||
request.setPath("a.txt");
|
||||
|
||||
expectedException.expect(new BaseMatcher<Object>() {
|
||||
@Override
|
||||
public void describeTo(Description description) {
|
||||
description.appendText("expected NotFoundException for revision");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Object item) {
|
||||
return "Revision".equals(((NotFoundException)item).getContext().get(0).getType());
|
||||
}
|
||||
});
|
||||
|
||||
execute(request);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleStream() throws IOException {
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
request.setPath("b.txt");
|
||||
|
||||
@@ -113,7 +145,7 @@ public class GitCatCommandTest extends AbstractGitCommandTestBase {
|
||||
catResultStream.close();
|
||||
}
|
||||
|
||||
private String execute(CatCommandRequest request) throws IOException, PathNotFoundException, RevisionNotFoundException {
|
||||
private String execute(CatCommandRequest request) throws IOException {
|
||||
String content = null;
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class GitDiffCommandTest extends AbstractGitCommandTestBase {
|
||||
|
||||
public static final String DIFF_FILE_A = "diff --git a/a.txt b/a.txt\n" +
|
||||
"index 7898192..1dc60c7 100644\n" +
|
||||
"--- a/a.txt\n" +
|
||||
"+++ b/a.txt\n" +
|
||||
"@@ -1 +1 @@\n" +
|
||||
"-a\n" +
|
||||
"+a and b\n";
|
||||
public static final String DIFF_FILE_B = "diff --git a/b.txt b/b.txt\n" +
|
||||
"deleted file mode 100644\n" +
|
||||
"index 6178079..0000000\n" +
|
||||
"--- a/b.txt\n" +
|
||||
"+++ /dev/null\n" +
|
||||
"@@ -1 +0,0 @@\n" +
|
||||
"-b\n";
|
||||
public static final String DIFF_FILE_A_MULTIPLE_REVISIONS = "diff --git a/a.txt b/a.txt\n" +
|
||||
"index 7898192..2f8bc28 100644\n" +
|
||||
"--- a/a.txt\n" +
|
||||
"+++ b/a.txt\n" +
|
||||
"@@ -1 +1,2 @@\n" +
|
||||
" a\n" +
|
||||
"+line for blame\n";
|
||||
public static final String DIFF_FILE_F_MULTIPLE_REVISIONS = "diff --git a/f.txt b/f.txt\n" +
|
||||
"new file mode 100644\n" +
|
||||
"index 0000000..6a69f92\n" +
|
||||
"--- /dev/null\n" +
|
||||
"+++ b/f.txt\n" +
|
||||
"@@ -0,0 +1 @@\n" +
|
||||
"+f\n";
|
||||
|
||||
@Test
|
||||
public void diffForOneRevisionShouldCreateDiff() {
|
||||
GitDiffCommand gitDiffCommand = new GitDiffCommand(createContext(), repository);
|
||||
DiffCommandRequest diffCommandRequest = new DiffCommandRequest();
|
||||
diffCommandRequest.setRevision("3f76a12f08a6ba0dc988c68b7f0b2cd190efc3c4");
|
||||
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
||||
gitDiffCommand.getDiffResult(diffCommandRequest, output);
|
||||
assertEquals(DIFF_FILE_A + DIFF_FILE_B, output.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void diffForOneBranchShouldCreateDiff() {
|
||||
GitDiffCommand gitDiffCommand = new GitDiffCommand(createContext(), repository);
|
||||
DiffCommandRequest diffCommandRequest = new DiffCommandRequest();
|
||||
diffCommandRequest.setRevision("test-branch");
|
||||
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
||||
gitDiffCommand.getDiffResult(diffCommandRequest, output);
|
||||
assertEquals(DIFF_FILE_A + DIFF_FILE_B, output.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void diffForPathShouldCreateLimitedDiff() {
|
||||
GitDiffCommand gitDiffCommand = new GitDiffCommand(createContext(), repository);
|
||||
DiffCommandRequest diffCommandRequest = new DiffCommandRequest();
|
||||
diffCommandRequest.setRevision("test-branch");
|
||||
diffCommandRequest.setPath("a.txt");
|
||||
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
||||
gitDiffCommand.getDiffResult(diffCommandRequest, output);
|
||||
assertEquals(DIFF_FILE_A, output.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void diffBetweenTwoBranchesShouldCreateDiff() {
|
||||
GitDiffCommand gitDiffCommand = new GitDiffCommand(createContext(), repository);
|
||||
DiffCommandRequest diffCommandRequest = new DiffCommandRequest();
|
||||
diffCommandRequest.setRevision("master");
|
||||
diffCommandRequest.setAncestorChangeset("test-branch");
|
||||
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
||||
gitDiffCommand.getDiffResult(diffCommandRequest, output);
|
||||
assertEquals(DIFF_FILE_A_MULTIPLE_REVISIONS + DIFF_FILE_F_MULTIPLE_REVISIONS, output.toString());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void diffBetweenTwoBranchesForPathShouldCreateLimitedDiff() {
|
||||
GitDiffCommand gitDiffCommand = new GitDiffCommand(createContext(), repository);
|
||||
DiffCommandRequest diffCommandRequest = new DiffCommandRequest();
|
||||
diffCommandRequest.setRevision("master");
|
||||
diffCommandRequest.setAncestorChangeset("test-branch");
|
||||
diffCommandRequest.setPath("a.txt");
|
||||
ByteArrayOutputStream output = new ByteArrayOutputStream();
|
||||
gitDiffCommand.getDiffResult(diffCommandRequest, output);
|
||||
assertEquals(DIFF_FILE_A_MULTIPLE_REVISIONS, output.toString());
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,6 @@ public class GitIncomingCommandTest
|
||||
*
|
||||
* @throws GitAPIException
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testGetIncomingChangesets()
|
||||
@@ -95,7 +94,6 @@ public class GitIncomingCommandTest
|
||||
*
|
||||
* @throws GitAPIException
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testGetIncomingChangesetsWithAllreadyPullChangesets()
|
||||
@@ -105,7 +103,7 @@ public class GitIncomingCommandTest
|
||||
|
||||
commit(outgoing, "added a");
|
||||
|
||||
GitPullCommand pull = new GitPullCommand(handler, new GitContext(incomingDirectory), incomingRepository);
|
||||
GitPullCommand pull = new GitPullCommand(handler, new GitContext(incomingDirectory, null), incomingRepository);
|
||||
PullCommandRequest req = new PullCommandRequest();
|
||||
req.setRemoteRepository(outgoingRepository);
|
||||
pull.pull(req);
|
||||
@@ -132,7 +130,6 @@ public class GitIncomingCommandTest
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testGetIncomingChangesetsWithEmptyRepository()
|
||||
@@ -156,7 +153,6 @@ public class GitIncomingCommandTest
|
||||
*
|
||||
* @throws GitAPIException
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
@Ignore
|
||||
@@ -191,7 +187,7 @@ public class GitIncomingCommandTest
|
||||
*/
|
||||
private GitIncomingCommand createCommand()
|
||||
{
|
||||
return new GitIncomingCommand(handler, new GitContext(incomingDirectory),
|
||||
return new GitIncomingCommand(handler, new GitContext(incomingDirectory, null),
|
||||
incomingRepository);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
|
||||
* Tests log command with the usage of a default branch.
|
||||
*/
|
||||
@Test
|
||||
public void testGetDefaultBranch() throws Exception {
|
||||
public void testGetDefaultBranch() {
|
||||
// without default branch, the repository head should be used
|
||||
ChangesetPagingResult result = createCommand().getChangesets(new LogCommandRequest());
|
||||
|
||||
@@ -92,7 +92,7 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAll() throws Exception
|
||||
public void testGetAll()
|
||||
{
|
||||
ChangesetPagingResult result =
|
||||
createCommand().getChangesets(new LogCommandRequest());
|
||||
@@ -103,7 +103,7 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAllByPath() throws Exception
|
||||
public void testGetAllByPath()
|
||||
{
|
||||
LogCommandRequest request = new LogCommandRequest();
|
||||
|
||||
@@ -119,7 +119,7 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAllWithLimit() throws Exception
|
||||
public void testGetAllWithLimit()
|
||||
{
|
||||
LogCommandRequest request = new LogCommandRequest();
|
||||
|
||||
@@ -143,7 +143,7 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAllWithPaging() throws Exception
|
||||
public void testGetAllWithPaging()
|
||||
{
|
||||
LogCommandRequest request = new LogCommandRequest();
|
||||
|
||||
@@ -194,7 +194,7 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetRange() throws Exception
|
||||
public void testGetRange()
|
||||
{
|
||||
LogCommandRequest request = new LogCommandRequest();
|
||||
|
||||
@@ -216,6 +216,26 @@ public class GitLogCommandTest extends AbstractGitCommandTestBase
|
||||
assertEquals("435df2f061add3589cb326cc64be9b9c3897ceca", c2.getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAncestor()
|
||||
{
|
||||
LogCommandRequest request = new LogCommandRequest();
|
||||
|
||||
request.setBranch("test-branch");
|
||||
request.setAncestorChangeset("master");
|
||||
|
||||
ChangesetPagingResult result = createCommand().getChangesets(request);
|
||||
|
||||
assertNotNull(result);
|
||||
assertEquals(1, result.getTotal());
|
||||
assertEquals(1, result.getChangesets().size());
|
||||
|
||||
Changeset c = result.getChangesets().get(0);
|
||||
|
||||
assertNotNull(c);
|
||||
assertEquals("3f76a12f08a6ba0dc988c68b7f0b2cd190efc3c4", c.getId());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldFindDefaultBranchFromHEAD() throws Exception {
|
||||
setRepositoryHeadReference("ref: refs/heads/test-branch");
|
||||
|
||||
@@ -0,0 +1,139 @@
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
import com.github.sdorra.shiro.ShiroRule;
|
||||
import com.github.sdorra.shiro.SubjectAware;
|
||||
import org.apache.shiro.subject.SimplePrincipalCollection;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.eclipse.jgit.api.Git;
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
import org.eclipse.jgit.lib.PersonIdent;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
import org.eclipse.jgit.revwalk.RevCommit;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import sonia.scm.repository.Person;
|
||||
import sonia.scm.repository.api.MergeCommandResult;
|
||||
import sonia.scm.user.User;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@SubjectAware(configuration = "classpath:sonia/scm/configuration/shiro.ini")
|
||||
public class GitMergeCommandTest extends AbstractGitCommandTestBase {
|
||||
|
||||
private static final String REALM = "AdminRealm";
|
||||
|
||||
@Rule
|
||||
public ShiroRule shiro = new ShiroRule();
|
||||
|
||||
@Test
|
||||
public void shouldDetectMergeableBranches() {
|
||||
GitMergeCommand command = createCommand();
|
||||
MergeCommandRequest request = new MergeCommandRequest();
|
||||
request.setBranchToMerge("mergeable");
|
||||
request.setTargetBranch("master");
|
||||
|
||||
boolean mergeable = command.dryRun(request).isMergeable();
|
||||
|
||||
assertThat(mergeable).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldDetectNotMergeableBranches() {
|
||||
GitMergeCommand command = createCommand();
|
||||
MergeCommandRequest request = new MergeCommandRequest();
|
||||
request.setBranchToMerge("test-branch");
|
||||
request.setTargetBranch("master");
|
||||
|
||||
boolean mergeable = command.dryRun(request).isMergeable();
|
||||
|
||||
assertThat(mergeable).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldMergeMergeableBranches() throws IOException, GitAPIException {
|
||||
GitMergeCommand command = createCommand();
|
||||
MergeCommandRequest request = new MergeCommandRequest();
|
||||
request.setTargetBranch("master");
|
||||
request.setBranchToMerge("mergeable");
|
||||
request.setAuthor(new Person("Dirk Gently", "dirk@holistic.det"));
|
||||
|
||||
MergeCommandResult mergeCommandResult = command.merge(request);
|
||||
|
||||
assertThat(mergeCommandResult.isSuccess()).isTrue();
|
||||
|
||||
Repository repository = createContext().open();
|
||||
Iterable<RevCommit> commits = new Git(repository).log().add(repository.resolve("master")).setMaxCount(1).call();
|
||||
RevCommit mergeCommit = commits.iterator().next();
|
||||
PersonIdent mergeAuthor = mergeCommit.getAuthorIdent();
|
||||
String message = mergeCommit.getFullMessage();
|
||||
assertThat(mergeAuthor.getName()).isEqualTo("Dirk Gently");
|
||||
assertThat(mergeAuthor.getEmailAddress()).isEqualTo("dirk@holistic.det");
|
||||
assertThat(message).contains("master", "mergeable");
|
||||
// We expect the merge result of file b.txt here by looking up the sha hash of its content.
|
||||
// If the file is missing (aka not merged correctly) this will throw a MissingObjectException:
|
||||
byte[] contentOfFileB = repository.open(repository.resolve("9513e9c76e73f3e562fd8e4c909d0607113c77c6")).getBytes();
|
||||
assertThat(new String(contentOfFileB)).isEqualTo("b\ncontent from branch\n");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldUseConfiguredCommitMessageTemplate() throws IOException, GitAPIException {
|
||||
GitMergeCommand command = createCommand();
|
||||
MergeCommandRequest request = new MergeCommandRequest();
|
||||
request.setTargetBranch("master");
|
||||
request.setBranchToMerge("mergeable");
|
||||
request.setAuthor(new Person("Dirk Gently", "dirk@holistic.det"));
|
||||
request.setMessageTemplate("simple");
|
||||
|
||||
MergeCommandResult mergeCommandResult = command.merge(request);
|
||||
|
||||
assertThat(mergeCommandResult.isSuccess()).isTrue();
|
||||
|
||||
Repository repository = createContext().open();
|
||||
Iterable<RevCommit> commits = new Git(repository).log().add(repository.resolve("master")).setMaxCount(1).call();
|
||||
RevCommit mergeCommit = commits.iterator().next();
|
||||
String message = mergeCommit.getFullMessage();
|
||||
assertThat(message).isEqualTo("simple");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void shouldNotMergeConflictingBranches() {
|
||||
GitMergeCommand command = createCommand();
|
||||
MergeCommandRequest request = new MergeCommandRequest();
|
||||
request.setBranchToMerge("test-branch");
|
||||
request.setTargetBranch("master");
|
||||
|
||||
MergeCommandResult mergeCommandResult = command.merge(request);
|
||||
|
||||
assertThat(mergeCommandResult.isSuccess()).isFalse();
|
||||
assertThat(mergeCommandResult.getFilesWithConflict()).containsExactly("a.txt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@SubjectAware(username = "admin", password = "secret")
|
||||
public void shouldTakeAuthorFromSubjectIfNotSet() throws IOException, GitAPIException {
|
||||
shiro.setSubject(
|
||||
new Subject.Builder()
|
||||
.principals(new SimplePrincipalCollection(new User("dirk", "Dirk Gently", "dirk@holistic.det"), REALM))
|
||||
.buildSubject());
|
||||
GitMergeCommand command = createCommand();
|
||||
MergeCommandRequest request = new MergeCommandRequest();
|
||||
request.setTargetBranch("master");
|
||||
request.setBranchToMerge("mergeable");
|
||||
|
||||
MergeCommandResult mergeCommandResult = command.merge(request);
|
||||
|
||||
assertThat(mergeCommandResult.isSuccess()).isTrue();
|
||||
|
||||
Repository repository = createContext().open();
|
||||
Iterable<RevCommit> mergeCommit = new Git(repository).log().add(repository.resolve("master")).setMaxCount(1).call();
|
||||
PersonIdent mergeAuthor = mergeCommit.iterator().next().getAuthorIdent();
|
||||
assertThat(mergeAuthor.getName()).isEqualTo("Dirk Gently");
|
||||
assertThat(mergeAuthor.getEmailAddress()).isEqualTo("dirk@holistic.det");
|
||||
}
|
||||
|
||||
private GitMergeCommand createCommand() {
|
||||
return new GitMergeCommand(createContext(), repository, new SimpleGitWorkdirFactory());
|
||||
}
|
||||
}
|
||||
@@ -18,8 +18,8 @@ public class GitModificationsCommandTest extends AbstractRemoteCommandTestBase {
|
||||
|
||||
@Before
|
||||
public void init() {
|
||||
incomingModificationsCommand = new GitModificationsCommand(new GitContext(incomingDirectory), incomingRepository);
|
||||
outgoingModificationsCommand = new GitModificationsCommand(new GitContext(outgoingDirectory), outgoingRepository);
|
||||
incomingModificationsCommand = new GitModificationsCommand(new GitContext(incomingDirectory, null), incomingRepository);
|
||||
outgoingModificationsCommand = new GitModificationsCommand(new GitContext(outgoingDirectory, null), outgoingRepository);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -63,12 +63,12 @@ public class GitModificationsCommandTest extends AbstractRemoteCommandTestBase {
|
||||
}
|
||||
|
||||
void pushOutgoingAndPullIncoming() throws IOException {
|
||||
GitPushCommand cmd = new GitPushCommand(handler, new GitContext(outgoingDirectory),
|
||||
GitPushCommand cmd = new GitPushCommand(handler, new GitContext(outgoingDirectory, null),
|
||||
outgoingRepository);
|
||||
PushCommandRequest request = new PushCommandRequest();
|
||||
request.setRemoteRepository(incomingRepository);
|
||||
cmd.push(request);
|
||||
GitPullCommand pullCommand = new GitPullCommand(handler, new GitContext(incomingDirectory),
|
||||
GitPullCommand pullCommand = new GitPullCommand(handler, new GitContext(incomingDirectory, null),
|
||||
incomingRepository);
|
||||
PullCommandRequest pullRequest = new PullCommandRequest();
|
||||
pullRequest.setRemoteRepository(incomingRepository);
|
||||
|
||||
@@ -61,7 +61,6 @@ public class GitOutgoingCommandTest extends AbstractRemoteCommandTestBase
|
||||
*
|
||||
* @throws GitAPIException
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testGetOutgoingChangesets()
|
||||
@@ -95,7 +94,6 @@ public class GitOutgoingCommandTest extends AbstractRemoteCommandTestBase
|
||||
*
|
||||
* @throws GitAPIException
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testGetOutgoingChangesetsWithAlreadyPushedChanges()
|
||||
@@ -106,7 +104,7 @@ public class GitOutgoingCommandTest extends AbstractRemoteCommandTestBase
|
||||
commit(outgoing, "added a");
|
||||
|
||||
GitPushCommand push = new GitPushCommand(handler,
|
||||
new GitContext(outgoingDirectory),
|
||||
new GitContext(outgoingDirectory, null),
|
||||
outgoingRepository);
|
||||
PushCommandRequest req = new PushCommandRequest();
|
||||
|
||||
@@ -135,7 +133,6 @@ public class GitOutgoingCommandTest extends AbstractRemoteCommandTestBase
|
||||
*
|
||||
*
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testGetOutgoingChangesetsWithEmptyRepository()
|
||||
@@ -161,7 +158,7 @@ public class GitOutgoingCommandTest extends AbstractRemoteCommandTestBase
|
||||
*/
|
||||
private GitOutgoingCommand createCommand()
|
||||
{
|
||||
return new GitOutgoingCommand(handler, new GitContext(outgoingDirectory),
|
||||
return new GitOutgoingCommand(handler, new GitContext(outgoingDirectory, null),
|
||||
outgoingRepository);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,6 @@ public class GitPushCommandTest extends AbstractRemoteCommandTestBase
|
||||
*
|
||||
* @throws GitAPIException
|
||||
* @throws IOException
|
||||
* @throws RepositoryException
|
||||
*/
|
||||
@Test
|
||||
public void testPush()
|
||||
@@ -99,7 +98,7 @@ public class GitPushCommandTest extends AbstractRemoteCommandTestBase
|
||||
*/
|
||||
private GitPushCommand createCommand()
|
||||
{
|
||||
return new GitPushCommand(handler, new GitContext(outgoingDirectory),
|
||||
return new GitPushCommand(handler, new GitContext(outgoingDirectory, null),
|
||||
outgoingRepository);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
import org.eclipse.jgit.api.errors.GitAPIException;
|
||||
import org.eclipse.jgit.lib.Repository;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.mockito.Mockito.spy;
|
||||
import static org.mockito.Mockito.verify;
|
||||
|
||||
public class SimpleGitWorkdirFactoryTest extends AbstractGitCommandTestBase {
|
||||
|
||||
@Rule
|
||||
public TemporaryFolder temporaryFolder = new TemporaryFolder();
|
||||
|
||||
@Test
|
||||
public void emptyPoolShouldCreateNewWorkdir() throws IOException {
|
||||
SimpleGitWorkdirFactory factory = new SimpleGitWorkdirFactory(temporaryFolder.newFolder());
|
||||
File masterRepo = createRepositoryDirectory();
|
||||
|
||||
try (WorkingCopy workingCopy = factory.createWorkingCopy(createContext())) {
|
||||
|
||||
assertThat(workingCopy.get().getDirectory())
|
||||
.exists()
|
||||
.isNotEqualTo(masterRepo)
|
||||
.isDirectory();
|
||||
assertThat(new File(workingCopy.get().getWorkTree(), "a.txt"))
|
||||
.exists()
|
||||
.isFile()
|
||||
.hasContent("a\nline for blame");
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void cloneFromPoolShouldBeClosed() throws IOException {
|
||||
PoolWithSpy factory = new PoolWithSpy(temporaryFolder.newFolder());
|
||||
|
||||
try (WorkingCopy workingCopy = factory.createWorkingCopy(createContext())) {
|
||||
assertThat(workingCopy).isNotNull();
|
||||
}
|
||||
verify(factory.createdClone).close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void cloneFromPoolShouldNotBeReused() throws IOException {
|
||||
SimpleGitWorkdirFactory factory = new SimpleGitWorkdirFactory(temporaryFolder.newFolder());
|
||||
|
||||
File firstDirectory;
|
||||
try (WorkingCopy workingCopy = factory.createWorkingCopy(createContext())) {
|
||||
firstDirectory = workingCopy.get().getDirectory();
|
||||
}
|
||||
try (WorkingCopy workingCopy = factory.createWorkingCopy(createContext())) {
|
||||
File secondDirectory = workingCopy.get().getDirectory();
|
||||
assertThat(secondDirectory).isNotEqualTo(firstDirectory);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void cloneFromPoolShouldBeDeletedOnClose() throws IOException {
|
||||
SimpleGitWorkdirFactory factory = new SimpleGitWorkdirFactory(temporaryFolder.newFolder());
|
||||
|
||||
File directory;
|
||||
try (WorkingCopy workingCopy = factory.createWorkingCopy(createContext())) {
|
||||
directory = workingCopy.get().getWorkTree();
|
||||
}
|
||||
assertThat(directory).doesNotExist();
|
||||
}
|
||||
|
||||
private static class PoolWithSpy extends SimpleGitWorkdirFactory {
|
||||
PoolWithSpy(File poolDirectory) {
|
||||
super(poolDirectory);
|
||||
}
|
||||
|
||||
Repository createdClone;
|
||||
|
||||
@Override
|
||||
protected Repository cloneRepository(File bareRepository, File destination) throws GitAPIException {
|
||||
createdClone = spy(super.cloneRepository(bareRepository, destination));
|
||||
return createdClone;
|
||||
}
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -707,9 +707,9 @@
|
||||
version "0.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@scm-manager/eslint-config/-/eslint-config-0.0.2.tgz#94cc8c3fb4f51f870b235893dc134fc6c423ae85"
|
||||
|
||||
"@scm-manager/ui-bundler@^0.0.17":
|
||||
version "0.0.17"
|
||||
resolved "https://registry.yarnpkg.com/@scm-manager/ui-bundler/-/ui-bundler-0.0.17.tgz#949b90ca57e4268be28fcf4975bd9622f60278bb"
|
||||
"@scm-manager/ui-bundler@^0.0.21":
|
||||
version "0.0.21"
|
||||
resolved "https://registry.yarnpkg.com/@scm-manager/ui-bundler/-/ui-bundler-0.0.21.tgz#f8b5fa355415cc67b8aaf8744e1701a299dff647"
|
||||
dependencies:
|
||||
"@babel/core" "^7.0.0"
|
||||
"@babel/plugin-proposal-class-properties" "^7.0.0"
|
||||
@@ -747,9 +747,9 @@
|
||||
vinyl-source-stream "^2.0.0"
|
||||
watchify "^3.11.0"
|
||||
|
||||
"@scm-manager/ui-extensions@^0.0.7":
|
||||
version "0.0.7"
|
||||
resolved "https://registry.yarnpkg.com/@scm-manager/ui-extensions/-/ui-extensions-0.0.7.tgz#a0a657a1410b78838ba0b36096ef631dca7fe27e"
|
||||
"@scm-manager/ui-extensions@^0.1.1":
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/@scm-manager/ui-extensions/-/ui-extensions-0.1.1.tgz#966e62d89981e92a14adf7e674e646e76de96d45"
|
||||
dependencies:
|
||||
react "^16.4.2"
|
||||
react-dom "^16.4.2"
|
||||
|
||||
@@ -4,5 +4,6 @@
|
||||
[include]
|
||||
|
||||
[libs]
|
||||
./node_modules/@scm-manager/ui-components/flow-typed
|
||||
|
||||
[options]
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
// flow-typed signature: cf86673cc32d185bdab1d2ea90578d37
|
||||
// flow-typed version: 614bf49aa8/classnames_v2.x.x/flow_>=v0.25.x
|
||||
|
||||
type $npm$classnames$Classes =
|
||||
| string
|
||||
| { [className: string]: * }
|
||||
| false
|
||||
| void
|
||||
| null;
|
||||
|
||||
declare module "classnames" {
|
||||
declare module.exports: (
|
||||
...classes: Array<$npm$classnames$Classes | $npm$classnames$Classes[]>
|
||||
) => string;
|
||||
}
|
||||
|
||||
declare module "classnames/bind" {
|
||||
declare module.exports: $Exports<"classnames">;
|
||||
}
|
||||
|
||||
declare module "classnames/dedupe" {
|
||||
declare module.exports: $Exports<"classnames">;
|
||||
}
|
||||
1108
scm-plugins/scm-hg-plugin/flow-typed/npm/jest_v23.x.x.js
vendored
1108
scm-plugins/scm-hg-plugin/flow-typed/npm/jest_v23.x.x.js
vendored
File diff suppressed because it is too large
Load Diff
@@ -1,331 +0,0 @@
|
||||
// flow-typed signature: 23b805356f90ad9384dd88489654e380
|
||||
// flow-typed version: e9374c5fe9/moment_v2.3.x/flow_>=v0.25.x
|
||||
|
||||
type moment$MomentOptions = {
|
||||
y?: number | string,
|
||||
year?: number | string,
|
||||
years?: number | string,
|
||||
M?: number | string,
|
||||
month?: number | string,
|
||||
months?: number | string,
|
||||
d?: number | string,
|
||||
day?: number | string,
|
||||
days?: number | string,
|
||||
date?: number | string,
|
||||
h?: number | string,
|
||||
hour?: number | string,
|
||||
hours?: number | string,
|
||||
m?: number | string,
|
||||
minute?: number | string,
|
||||
minutes?: number | string,
|
||||
s?: number | string,
|
||||
second?: number | string,
|
||||
seconds?: number | string,
|
||||
ms?: number | string,
|
||||
millisecond?: number | string,
|
||||
milliseconds?: number | string
|
||||
};
|
||||
|
||||
type moment$MomentObject = {
|
||||
years: number,
|
||||
months: number,
|
||||
date: number,
|
||||
hours: number,
|
||||
minutes: number,
|
||||
seconds: number,
|
||||
milliseconds: number
|
||||
};
|
||||
|
||||
type moment$MomentCreationData = {
|
||||
input: string,
|
||||
format: string,
|
||||
locale: Object,
|
||||
isUTC: boolean,
|
||||
strict: boolean
|
||||
};
|
||||
|
||||
type moment$CalendarFormat = string | ((moment: moment$Moment) => string);
|
||||
|
||||
type moment$CalendarFormats = {
|
||||
sameDay?: moment$CalendarFormat,
|
||||
nextDay?: moment$CalendarFormat,
|
||||
nextWeek?: moment$CalendarFormat,
|
||||
lastDay?: moment$CalendarFormat,
|
||||
lastWeek?: moment$CalendarFormat,
|
||||
sameElse?: moment$CalendarFormat
|
||||
};
|
||||
|
||||
declare class moment$LocaleData {
|
||||
months(moment: moment$Moment): string,
|
||||
monthsShort(moment: moment$Moment): string,
|
||||
monthsParse(month: string): number,
|
||||
weekdays(moment: moment$Moment): string,
|
||||
weekdaysShort(moment: moment$Moment): string,
|
||||
weekdaysMin(moment: moment$Moment): string,
|
||||
weekdaysParse(weekDay: string): number,
|
||||
longDateFormat(dateFormat: string): string,
|
||||
isPM(date: string): boolean,
|
||||
meridiem(hours: number, minutes: number, isLower: boolean): string,
|
||||
calendar(
|
||||
key:
|
||||
| "sameDay"
|
||||
| "nextDay"
|
||||
| "lastDay"
|
||||
| "nextWeek"
|
||||
| "prevWeek"
|
||||
| "sameElse",
|
||||
moment: moment$Moment
|
||||
): string,
|
||||
relativeTime(
|
||||
number: number,
|
||||
withoutSuffix: boolean,
|
||||
key: "s" | "m" | "mm" | "h" | "hh" | "d" | "dd" | "M" | "MM" | "y" | "yy",
|
||||
isFuture: boolean
|
||||
): string,
|
||||
pastFuture(diff: any, relTime: string): string,
|
||||
ordinal(number: number): string,
|
||||
preparse(str: string): any,
|
||||
postformat(str: string): any,
|
||||
week(moment: moment$Moment): string,
|
||||
invalidDate(): string,
|
||||
firstDayOfWeek(): number,
|
||||
firstDayOfYear(): number
|
||||
}
|
||||
declare class moment$MomentDuration {
|
||||
humanize(suffix?: boolean): string,
|
||||
milliseconds(): number,
|
||||
asMilliseconds(): number,
|
||||
seconds(): number,
|
||||
asSeconds(): number,
|
||||
minutes(): number,
|
||||
asMinutes(): number,
|
||||
hours(): number,
|
||||
asHours(): number,
|
||||
days(): number,
|
||||
asDays(): number,
|
||||
months(): number,
|
||||
asWeeks(): number,
|
||||
weeks(): number,
|
||||
asMonths(): number,
|
||||
years(): number,
|
||||
asYears(): number,
|
||||
add(value: number | moment$MomentDuration | Object, unit?: string): this,
|
||||
subtract(value: number | moment$MomentDuration | Object, unit?: string): this,
|
||||
as(unit: string): number,
|
||||
get(unit: string): number,
|
||||
toJSON(): string,
|
||||
toISOString(): string,
|
||||
isValid(): boolean
|
||||
}
|
||||
declare class moment$Moment {
|
||||
static ISO_8601: string,
|
||||
static (
|
||||
string?: string,
|
||||
format?: string | Array<string>,
|
||||
strict?: boolean
|
||||
): moment$Moment,
|
||||
static (
|
||||
string?: string,
|
||||
format?: string | Array<string>,
|
||||
locale?: string,
|
||||
strict?: boolean
|
||||
): moment$Moment,
|
||||
static (
|
||||
initDate: ?Object | number | Date | Array<number> | moment$Moment | string
|
||||
): moment$Moment,
|
||||
static unix(seconds: number): moment$Moment,
|
||||
static utc(): moment$Moment,
|
||||
static utc(number: number | Array<number>): moment$Moment,
|
||||
static utc(
|
||||
str: string,
|
||||
str2?: string | Array<string>,
|
||||
str3?: string
|
||||
): moment$Moment,
|
||||
static utc(moment: moment$Moment): moment$Moment,
|
||||
static utc(date: Date): moment$Moment,
|
||||
static parseZone(): moment$Moment,
|
||||
static parseZone(rawDate: string): moment$Moment,
|
||||
static parseZone(
|
||||
rawDate: string,
|
||||
format: string | Array<string>
|
||||
): moment$Moment,
|
||||
static parseZone(
|
||||
rawDate: string,
|
||||
format: string,
|
||||
strict: boolean
|
||||
): moment$Moment,
|
||||
static parseZone(
|
||||
rawDate: string,
|
||||
format: string,
|
||||
locale: string,
|
||||
strict: boolean
|
||||
): moment$Moment,
|
||||
isValid(): boolean,
|
||||
invalidAt(): 0 | 1 | 2 | 3 | 4 | 5 | 6,
|
||||
creationData(): moment$MomentCreationData,
|
||||
millisecond(number: number): this,
|
||||
milliseconds(number: number): this,
|
||||
millisecond(): number,
|
||||
milliseconds(): number,
|
||||
second(number: number): this,
|
||||
seconds(number: number): this,
|
||||
second(): number,
|
||||
seconds(): number,
|
||||
minute(number: number): this,
|
||||
minutes(number: number): this,
|
||||
minute(): number,
|
||||
minutes(): number,
|
||||
hour(number: number): this,
|
||||
hours(number: number): this,
|
||||
hour(): number,
|
||||
hours(): number,
|
||||
date(number: number): this,
|
||||
dates(number: number): this,
|
||||
date(): number,
|
||||
dates(): number,
|
||||
day(day: number | string): this,
|
||||
days(day: number | string): this,
|
||||
day(): number,
|
||||
days(): number,
|
||||
weekday(number: number): this,
|
||||
weekday(): number,
|
||||
isoWeekday(number: number): this,
|
||||
isoWeekday(): number,
|
||||
dayOfYear(number: number): this,
|
||||
dayOfYear(): number,
|
||||
week(number: number): this,
|
||||
weeks(number: number): this,
|
||||
week(): number,
|
||||
weeks(): number,
|
||||
isoWeek(number: number): this,
|
||||
isoWeeks(number: number): this,
|
||||
isoWeek(): number,
|
||||
isoWeeks(): number,
|
||||
month(number: number): this,
|
||||
months(number: number): this,
|
||||
month(): number,
|
||||
months(): number,
|
||||
quarter(number: number): this,
|
||||
quarter(): number,
|
||||
year(number: number): this,
|
||||
years(number: number): this,
|
||||
year(): number,
|
||||
years(): number,
|
||||
weekYear(number: number): this,
|
||||
weekYear(): number,
|
||||
isoWeekYear(number: number): this,
|
||||
isoWeekYear(): number,
|
||||
weeksInYear(): number,
|
||||
isoWeeksInYear(): number,
|
||||
get(string: string): number,
|
||||
set(unit: string, value: number): this,
|
||||
set(options: { [unit: string]: number }): this,
|
||||
static max(...dates: Array<moment$Moment>): moment$Moment,
|
||||
static max(dates: Array<moment$Moment>): moment$Moment,
|
||||
static min(...dates: Array<moment$Moment>): moment$Moment,
|
||||
static min(dates: Array<moment$Moment>): moment$Moment,
|
||||
add(
|
||||
value: number | moment$MomentDuration | moment$Moment | Object,
|
||||
unit?: string
|
||||
): this,
|
||||
subtract(
|
||||
value: number | moment$MomentDuration | moment$Moment | string | Object,
|
||||
unit?: string
|
||||
): this,
|
||||
startOf(unit: string): this,
|
||||
endOf(unit: string): this,
|
||||
local(): this,
|
||||
utc(): this,
|
||||
utcOffset(
|
||||
offset: number | string,
|
||||
keepLocalTime?: boolean,
|
||||
keepMinutes?: boolean
|
||||
): this,
|
||||
utcOffset(): number,
|
||||
format(format?: string): string,
|
||||
fromNow(removeSuffix?: boolean): string,
|
||||
from(
|
||||
value: moment$Moment | string | number | Date | Array<number>,
|
||||
removePrefix?: boolean
|
||||
): string,
|
||||
toNow(removePrefix?: boolean): string,
|
||||
to(
|
||||
value: moment$Moment | string | number | Date | Array<number>,
|
||||
removePrefix?: boolean
|
||||
): string,
|
||||
calendar(refTime?: any, formats?: moment$CalendarFormats): string,
|
||||
diff(
|
||||
date: moment$Moment | string | number | Date | Array<number>,
|
||||
format?: string,
|
||||
floating?: boolean
|
||||
): number,
|
||||
valueOf(): number,
|
||||
unix(): number,
|
||||
daysInMonth(): number,
|
||||
toDate(): Date,
|
||||
toArray(): Array<number>,
|
||||
toJSON(): string,
|
||||
toISOString(
|
||||
keepOffset?: boolean
|
||||
): string,
|
||||
toObject(): moment$MomentObject,
|
||||
isBefore(
|
||||
date?: moment$Moment | string | number | Date | Array<number>,
|
||||
units?: ?string
|
||||
): boolean,
|
||||
isSame(
|
||||
date?: moment$Moment | string | number | Date | Array<number>,
|
||||
units?: ?string
|
||||
): boolean,
|
||||
isAfter(
|
||||
date?: moment$Moment | string | number | Date | Array<number>,
|
||||
units?: ?string
|
||||
): boolean,
|
||||
isSameOrBefore(
|
||||
date?: moment$Moment | string | number | Date | Array<number>,
|
||||
units?: ?string
|
||||
): boolean,
|
||||
isSameOrAfter(
|
||||
date?: moment$Moment | string | number | Date | Array<number>,
|
||||
units?: ?string
|
||||
): boolean,
|
||||
isBetween(
|
||||
fromDate: moment$Moment | string | number | Date | Array<number>,
|
||||
toDate?: ?moment$Moment | string | number | Date | Array<number>,
|
||||
granularity?: ?string,
|
||||
inclusion?: ?string
|
||||
): boolean,
|
||||
isDST(): boolean,
|
||||
isDSTShifted(): boolean,
|
||||
isLeapYear(): boolean,
|
||||
clone(): moment$Moment,
|
||||
static isMoment(obj: any): boolean,
|
||||
static isDate(obj: any): boolean,
|
||||
static locale(locale: string, localeData?: Object): string,
|
||||
static updateLocale(locale: string, localeData?: ?Object): void,
|
||||
static locale(locales: Array<string>): string,
|
||||
locale(locale: string, customization?: Object | null): moment$Moment,
|
||||
locale(): string,
|
||||
static months(): Array<string>,
|
||||
static monthsShort(): Array<string>,
|
||||
static weekdays(): Array<string>,
|
||||
static weekdaysShort(): Array<string>,
|
||||
static weekdaysMin(): Array<string>,
|
||||
static months(): string,
|
||||
static monthsShort(): string,
|
||||
static weekdays(): string,
|
||||
static weekdaysShort(): string,
|
||||
static weekdaysMin(): string,
|
||||
static localeData(key?: string): moment$LocaleData,
|
||||
static duration(
|
||||
value: number | Object | string,
|
||||
unit?: string
|
||||
): moment$MomentDuration,
|
||||
static isDuration(obj: any): boolean,
|
||||
static normalizeUnits(unit: string): string,
|
||||
static invalid(object: any): moment$Moment
|
||||
}
|
||||
|
||||
declare module "moment" {
|
||||
declare module.exports: Class<moment$Moment>;
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
// flow-typed signature: ba35d02d668b0d0a3e04a63a6847974e
|
||||
// flow-typed version: <<STUB>>/react-jss_v8.6.1/flow_v0.79.1
|
||||
|
||||
/**
|
||||
* This is an autogenerated libdef stub for:
|
||||
*
|
||||
* 'react-jss'
|
||||
*
|
||||
* Fill this stub out by replacing all the `any` types.
|
||||
*
|
||||
* Once filled out, we encourage you to share your work with the
|
||||
* community by sending a pull request to:
|
||||
* https://github.com/flowtype/flow-typed
|
||||
*/
|
||||
|
||||
declare module 'react-jss' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* We include stubs for each file inside this npm package in case you need to
|
||||
* require those files directly. Feel free to delete any files that aren't
|
||||
* needed.
|
||||
*/
|
||||
declare module 'react-jss/dist/react-jss' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/dist/react-jss.min' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/compose' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/compose.test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/contextTypes' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/createHoc' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/getDisplayName' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/index' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/index.test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/injectSheet' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/injectSheet.test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/jss' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/JssProvider' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/JssProvider.test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/ns' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/propTypes' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
// Filename aliases
|
||||
declare module 'react-jss/dist/react-jss.js' {
|
||||
declare module.exports: $Exports<'react-jss/dist/react-jss'>;
|
||||
}
|
||||
declare module 'react-jss/dist/react-jss.min.js' {
|
||||
declare module.exports: $Exports<'react-jss/dist/react-jss.min'>;
|
||||
}
|
||||
declare module 'react-jss/lib/compose.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/compose'>;
|
||||
}
|
||||
declare module 'react-jss/lib/compose.test.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/compose.test'>;
|
||||
}
|
||||
declare module 'react-jss/lib/contextTypes.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/contextTypes'>;
|
||||
}
|
||||
declare module 'react-jss/lib/createHoc.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/createHoc'>;
|
||||
}
|
||||
declare module 'react-jss/lib/getDisplayName.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/getDisplayName'>;
|
||||
}
|
||||
declare module 'react-jss/lib/index.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/index'>;
|
||||
}
|
||||
declare module 'react-jss/lib/index.test.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/index.test'>;
|
||||
}
|
||||
declare module 'react-jss/lib/injectSheet.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/injectSheet'>;
|
||||
}
|
||||
declare module 'react-jss/lib/injectSheet.test.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/injectSheet.test'>;
|
||||
}
|
||||
declare module 'react-jss/lib/jss.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/jss'>;
|
||||
}
|
||||
declare module 'react-jss/lib/JssProvider.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/JssProvider'>;
|
||||
}
|
||||
declare module 'react-jss/lib/JssProvider.test.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/JssProvider.test'>;
|
||||
}
|
||||
declare module 'react-jss/lib/ns.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/ns'>;
|
||||
}
|
||||
declare module 'react-jss/lib/propTypes.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/propTypes'>;
|
||||
}
|
||||
@@ -6,9 +6,9 @@
|
||||
"build": "ui-bundler plugin"
|
||||
},
|
||||
"dependencies": {
|
||||
"@scm-manager/ui-extensions": "^0.0.7"
|
||||
"@scm-manager/ui-extensions": "^0.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@scm-manager/ui-bundler": "^0.0.17"
|
||||
"@scm-manager/ui-bundler": "^0.0.21"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
@@ -16,7 +16,7 @@
|
||||
<description>Plugin for the version control system Mercurial</description>
|
||||
|
||||
<dependencies>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.aragost.javahg</groupId>
|
||||
<artifactId>javahg</artifactId>
|
||||
@@ -30,12 +30,10 @@
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<!-- create test jar -->
|
||||
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
|
||||
<plugin>
|
||||
<groupId>com.mycila.maven-license-plugin</groupId>
|
||||
<artifactId>maven-license-plugin</artifactId>
|
||||
@@ -54,7 +52,22 @@
|
||||
<strictCheck>true</strictCheck>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
|
||||
<plugin>
|
||||
<groupId>sonia.scm.maven</groupId>
|
||||
<artifactId>smp-maven-plugin</artifactId>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<corePlugin>true</corePlugin>
|
||||
<links>
|
||||
<link>@scm-manager/ui-types</link>
|
||||
<link>@scm-manager/ui-components</link>
|
||||
</links>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!-- create test jar -->
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
@@ -68,45 +81,18 @@
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>com.github.sdorra</groupId>
|
||||
<artifactId>buildfrontend-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>link-ui-types</id>
|
||||
<phase>process-sources</phase>
|
||||
<goals>
|
||||
<goal>install-link</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<pkg>@scm-manager/ui-types</pkg>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>link-ui-components</id>
|
||||
<phase>process-sources</phase>
|
||||
<goals>
|
||||
<goal>install-link</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<pkg>@scm-manager/ui-components</pkg>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
<repositories>
|
||||
|
||||
|
||||
<repository>
|
||||
<id>maven.scm-manager.org</id>
|
||||
<name>scm-manager release repository</name>
|
||||
<url>http://maven.scm-manager.org/nexus/content/groups/public</url>
|
||||
</repository>
|
||||
|
||||
|
||||
<repository>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
@@ -119,7 +105,7 @@
|
||||
<layout>default</layout>
|
||||
<url>https://oss.sonatype.org/content/groups/public/</url>
|
||||
</repository>
|
||||
|
||||
|
||||
</repositories>
|
||||
|
||||
|
||||
</project>
|
||||
|
||||
@@ -1,348 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.api.rest.resources;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
import sonia.scm.SCMContext;
|
||||
import sonia.scm.installer.HgInstallerFactory;
|
||||
import sonia.scm.installer.HgPackage;
|
||||
import sonia.scm.installer.HgPackageReader;
|
||||
import sonia.scm.installer.HgPackages;
|
||||
import sonia.scm.net.ahc.AdvancedHttpClient;
|
||||
import sonia.scm.repository.HgConfig;
|
||||
import sonia.scm.repository.HgRepositoryHandler;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.PathParam;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAccessType;
|
||||
import javax.xml.bind.annotation.XmlAccessorType;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@Singleton
|
||||
@Path("config/repositories/hg")
|
||||
public class HgConfigResource
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param client
|
||||
* @param handler
|
||||
* @param pkgReader
|
||||
*/
|
||||
@Inject
|
||||
public HgConfigResource(AdvancedHttpClient client,
|
||||
HgRepositoryHandler handler, HgPackageReader pkgReader)
|
||||
{
|
||||
this.client = client;
|
||||
this.handler = handler;
|
||||
this.pkgReader = pkgReader;
|
||||
}
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param uriInfo
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("auto-configuration")
|
||||
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
public HgConfig autoConfiguration(@Context UriInfo uriInfo)
|
||||
{
|
||||
return autoConfiguration(uriInfo, null);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param uriInfo
|
||||
* @param config
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("auto-configuration")
|
||||
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
public HgConfig autoConfiguration(@Context UriInfo uriInfo, HgConfig config)
|
||||
{
|
||||
if (config == null)
|
||||
{
|
||||
config = new HgConfig();
|
||||
}
|
||||
|
||||
handler.doAutoConfiguration(config);
|
||||
|
||||
return handler.getConfig();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
*
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("packages/{pkgId}")
|
||||
public Response installPackage(@PathParam("pkgId") String id)
|
||||
{
|
||||
Response response = null;
|
||||
HgPackage pkg = pkgReader.getPackage(id);
|
||||
|
||||
if (pkg != null)
|
||||
{
|
||||
if (HgInstallerFactory.createInstaller().installPackage(client, handler,
|
||||
SCMContext.getContext().getBaseDirectory(), pkg))
|
||||
{
|
||||
response = Response.noContent().build();
|
||||
}
|
||||
else
|
||||
{
|
||||
response =
|
||||
Response.status(Response.Status.INTERNAL_SERVER_ERROR).build();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
response = Response.status(Response.Status.NOT_FOUND).build();
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
public HgConfig getConfig()
|
||||
{
|
||||
HgConfig config = handler.getConfig();
|
||||
|
||||
if (config == null)
|
||||
{
|
||||
config = new HgConfig();
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("installations/hg")
|
||||
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
public InstallationsResponse getHgInstallations()
|
||||
{
|
||||
List<String> installations =
|
||||
HgInstallerFactory.createInstaller().getHgInstallations();
|
||||
|
||||
return new InstallationsResponse(installations);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("packages")
|
||||
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
public HgPackages getPackages()
|
||||
{
|
||||
return pkgReader.getPackages();
|
||||
}
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GET
|
||||
@Path("installations/python")
|
||||
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
public InstallationsResponse getPythonInstallations()
|
||||
{
|
||||
List<String> installations =
|
||||
HgInstallerFactory.createInstaller().getPythonInstallations();
|
||||
|
||||
return new InstallationsResponse(installations);
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param uriInfo
|
||||
* @param config
|
||||
*
|
||||
* @return
|
||||
*
|
||||
* @throws IOException
|
||||
*/
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
public Response setConfig(@Context UriInfo uriInfo, HgConfig config)
|
||||
throws IOException
|
||||
{
|
||||
handler.setConfig(config);
|
||||
handler.storeConfig();
|
||||
|
||||
return Response.created(uriInfo.getRequestUri()).build();
|
||||
}
|
||||
|
||||
//~--- inner classes --------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Class description
|
||||
*
|
||||
*
|
||||
* @version Enter version here..., 11/04/25
|
||||
* @author Enter your name here...
|
||||
*/
|
||||
@XmlAccessorType(XmlAccessType.FIELD)
|
||||
@XmlRootElement(name = "installations")
|
||||
public static class InstallationsResponse
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*/
|
||||
public InstallationsResponse() {}
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param paths
|
||||
*/
|
||||
public InstallationsResponse(List<String> paths)
|
||||
{
|
||||
this.paths = paths;
|
||||
}
|
||||
|
||||
//~--- get methods --------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public List<String> getPaths()
|
||||
{
|
||||
return paths;
|
||||
}
|
||||
|
||||
//~--- set methods --------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param paths
|
||||
*/
|
||||
public void setPaths(List<String> paths)
|
||||
{
|
||||
this.paths = paths;
|
||||
}
|
||||
|
||||
//~--- fields -------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
@XmlElement(name = "path")
|
||||
private List<String> paths;
|
||||
}
|
||||
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private AdvancedHttpClient client;
|
||||
|
||||
/** Field description */
|
||||
private HgRepositoryHandler handler;
|
||||
|
||||
/** Field description */
|
||||
private HgPackageReader pkgReader;
|
||||
}
|
||||
@@ -272,7 +272,7 @@ public class AbstractHgHandler
|
||||
} catch (JAXBException ex) {
|
||||
logger.error("could not parse result", ex);
|
||||
|
||||
throw new InternalRepositoryException("could not parse result", ex);
|
||||
throw new InternalRepositoryException(repository, "could not parse result", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -36,6 +36,9 @@ package sonia.scm.repository.spi;
|
||||
import com.aragost.javahg.commands.ExecutionException;
|
||||
import com.google.common.io.ByteStreams;
|
||||
import com.google.common.io.Closeables;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import sonia.scm.ContextEntry;
|
||||
import sonia.scm.repository.InternalRepositoryException;
|
||||
import sonia.scm.repository.Repository;
|
||||
import sonia.scm.web.HgUtil;
|
||||
@@ -46,6 +49,8 @@ import java.io.OutputStream;
|
||||
|
||||
public class HgCatCommand extends AbstractCommand implements CatCommand {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(HgCatCommand.class);
|
||||
|
||||
HgCatCommand(HgCommandContext context, Repository repository) {
|
||||
super(context, repository);
|
||||
}
|
||||
@@ -70,7 +75,8 @@ public class HgCatCommand extends AbstractCommand implements CatCommand {
|
||||
try {
|
||||
return cmd.execute(request.getPath());
|
||||
} catch (ExecutionException e) {
|
||||
throw new InternalRepositoryException(e);
|
||||
log.error("could not execute cat command", e);
|
||||
throw new InternalRepositoryException(ContextEntry.ContextBuilder.entity(getRepository()), "could not execute cat command", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public class HgIncomingCommand extends AbstractCommand
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InternalRepositoryException("could not execute incoming command", ex);
|
||||
throw new InternalRepositoryException(getRepository(), "could not execute incoming command", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,7 @@ public class HgOutgoingCommand extends AbstractCommand
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new InternalRepositoryException("could not execute outgoing command", ex);
|
||||
throw new InternalRepositoryException(getRepository(), "could not execute outgoing command", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -97,7 +97,7 @@ public class HgPullCommand extends AbstractHgPushOrPullCommand
|
||||
}
|
||||
catch (ExecutionException ex)
|
||||
{
|
||||
throw new InternalRepositoryException("could not execute push command", ex);
|
||||
throw new InternalRepositoryException(getRepository(), "could not execute push command", ex);
|
||||
}
|
||||
|
||||
return new PullResponse(result.size());
|
||||
|
||||
@@ -97,7 +97,7 @@ public class HgPushCommand extends AbstractHgPushOrPullCommand
|
||||
}
|
||||
catch (ExecutionException ex)
|
||||
{
|
||||
throw new InternalRepositoryException("could not execute push command", ex);
|
||||
throw new InternalRepositoryException(getRepository(), "could not execute push command", ex);
|
||||
}
|
||||
|
||||
return new PushResponse(result.size());
|
||||
|
||||
@@ -44,11 +44,11 @@ import org.apache.shiro.SecurityUtils;
|
||||
import org.apache.shiro.subject.Subject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import sonia.scm.NotFoundException;
|
||||
import sonia.scm.repository.HgContext;
|
||||
import sonia.scm.repository.HgHookManager;
|
||||
import sonia.scm.repository.HgRepositoryHandler;
|
||||
import sonia.scm.repository.RepositoryHookType;
|
||||
import sonia.scm.repository.RepositoryNotFoundException;
|
||||
import sonia.scm.repository.RepositoryUtil;
|
||||
import sonia.scm.repository.api.HgHookMessage;
|
||||
import sonia.scm.repository.api.HgHookMessage.Severity;
|
||||
@@ -275,17 +275,11 @@ public class HgHookCallbackServlet extends HttpServlet
|
||||
|
||||
printMessages(response, context);
|
||||
}
|
||||
catch (RepositoryNotFoundException ex)
|
||||
catch (NotFoundException ex)
|
||||
{
|
||||
if (logger.isErrorEnabled())
|
||||
{
|
||||
logger.error("could not find repository with id {}", id);
|
||||
logger.error(ex.getMessage());
|
||||
|
||||
if (logger.isTraceEnabled())
|
||||
{
|
||||
logger.trace("repository not found", ex);
|
||||
}
|
||||
}
|
||||
logger.trace("repository not found", ex);
|
||||
|
||||
response.sendError(HttpServletResponse.SC_NOT_FOUND);
|
||||
}
|
||||
|
||||
113
scm-plugins/scm-hg-plugin/src/main/js/HgConfigurationForm.js
Normal file
113
scm-plugins/scm-hg-plugin/src/main/js/HgConfigurationForm.js
Normal file
@@ -0,0 +1,113 @@
|
||||
//@flow
|
||||
import React from "react";
|
||||
import type { Links } from "@scm-manager/ui-types";
|
||||
import { translate } from "react-i18next";
|
||||
import { InputField, Checkbox } from "@scm-manager/ui-components";
|
||||
|
||||
type Configuration = {
|
||||
"hgBinary": string,
|
||||
"pythonBinary": string,
|
||||
"pythonPath"?: string,
|
||||
"repositoryDirectory": string,
|
||||
"encoding": string,
|
||||
"useOptimizedBytecode": boolean,
|
||||
"showRevisionInId": boolean,
|
||||
"disabled": boolean,
|
||||
"_links": Links
|
||||
};
|
||||
|
||||
type Props = {
|
||||
initialConfiguration: Configuration,
|
||||
readOnly: boolean,
|
||||
|
||||
onConfigurationChange: (Configuration, boolean) => void,
|
||||
|
||||
// context props
|
||||
t: (string) => string
|
||||
}
|
||||
|
||||
type State = Configuration & {
|
||||
validationErrors: string[]
|
||||
};
|
||||
|
||||
class HgConfigurationForm extends React.Component<Props, State> {
|
||||
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
this.state = { ...props.initialConfiguration, validationErrors: [] };
|
||||
}
|
||||
|
||||
updateValidationStatus = () => {
|
||||
const requiredFields = [
|
||||
"hgBinary", "pythonBinary", "repositoryDirectory", "encoding"
|
||||
];
|
||||
|
||||
const validationErrors = [];
|
||||
for (let field of requiredFields) {
|
||||
if (!this.state[field]) {
|
||||
validationErrors.push( field );
|
||||
}
|
||||
}
|
||||
|
||||
this.setState({
|
||||
validationErrors
|
||||
});
|
||||
|
||||
return validationErrors.length === 0;
|
||||
};
|
||||
|
||||
|
||||
hasValidationError = (name: string) => {
|
||||
return this.state.validationErrors.indexOf(name) >= 0;
|
||||
};
|
||||
|
||||
handleChange = (value: any, name: string) => {
|
||||
this.setState({
|
||||
[name]: value
|
||||
}, () => this.props.onConfigurationChange(this.state, this.updateValidationStatus()));
|
||||
};
|
||||
|
||||
inputField = (name: string) => {
|
||||
const { readOnly, t } = this.props;
|
||||
return <InputField
|
||||
name={ name }
|
||||
label={t("scm-hg-plugin.config." + name)}
|
||||
helpText={t("scm-hg-plugin.config." + name + "HelpText")}
|
||||
value={this.state[name]}
|
||||
onChange={this.handleChange}
|
||||
validationError={this.hasValidationError(name)}
|
||||
errorMessage={t("scm-hg-plugin.config.required")}
|
||||
disabled={readOnly}
|
||||
/>;
|
||||
};
|
||||
|
||||
checkbox = (name: string) => {
|
||||
const { readOnly, t } = this.props;
|
||||
return <Checkbox
|
||||
name={ name }
|
||||
label={t("scm-hg-plugin.config." + name)}
|
||||
helpText={t("scm-hg-plugin.config." + name + "HelpText")}
|
||||
checked={this.state[name]}
|
||||
onChange={this.handleChange}
|
||||
disabled={readOnly}
|
||||
/>;
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
<>
|
||||
{this.inputField("hgBinary")}
|
||||
{this.inputField("pythonBinary")}
|
||||
{this.inputField("pythonPath")}
|
||||
{this.inputField("repositoryDirectory")}
|
||||
{this.inputField("encoding")}
|
||||
{this.checkbox("useOptimizedBytecode")}
|
||||
{this.checkbox("showRevisionInId")}
|
||||
{this.checkbox("disabled")}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default translate("plugins")(HgConfigurationForm);
|
||||
@@ -0,0 +1,28 @@
|
||||
//@flow
|
||||
import React from "react";
|
||||
import { Title, GlobalConfiguration } from "@scm-manager/ui-components";
|
||||
import { translate } from "react-i18next";
|
||||
import HgConfigurationForm from "./HgConfigurationForm";
|
||||
|
||||
type Props = {
|
||||
link: string,
|
||||
|
||||
// context props
|
||||
t: (string) => string
|
||||
}
|
||||
|
||||
class HgGlobalConfiguration extends React.Component<Props> {
|
||||
|
||||
render() {
|
||||
const { link, t } = this.props;
|
||||
return (
|
||||
<div>
|
||||
<Title title={t("scm-hg-plugin.config.title")}/>
|
||||
<GlobalConfiguration link={link} render={props => <HgConfigurationForm {...props} />}/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default translate("plugins")(HgGlobalConfiguration);
|
||||
@@ -2,6 +2,8 @@
|
||||
import { binder } from "@scm-manager/ui-extensions";
|
||||
import ProtocolInformation from "./ProtocolInformation";
|
||||
import HgAvatar from "./HgAvatar";
|
||||
import { ConfigurationBinder as cfgBinder } from "@scm-manager/ui-components";
|
||||
import HgGlobalConfiguration from "./HgGlobalConfiguration";
|
||||
|
||||
const hgPredicate = (props: Object) => {
|
||||
return props.repository && props.repository.type === "hg";
|
||||
@@ -9,3 +11,7 @@ const hgPredicate = (props: Object) => {
|
||||
|
||||
binder.bind("repos.repository-details.information", ProtocolInformation, hgPredicate);
|
||||
binder.bind("repos.repository-avatar", HgAvatar, hgPredicate);
|
||||
|
||||
// bind global configuration
|
||||
|
||||
cfgBinder.bindGlobal("/hg", "scm-hg-plugin.config.link", "hgConfig", HgGlobalConfiguration);
|
||||
|
||||
@@ -4,6 +4,27 @@
|
||||
"clone" : "Clone the repository",
|
||||
"create" : "Create a new repository",
|
||||
"replace" : "Push an existing repository"
|
||||
},
|
||||
"config": {
|
||||
"link": "Mercurial",
|
||||
"title": "Mercurial Configuration",
|
||||
"hgBinary": "HG Binary",
|
||||
"hgBinaryHelpText": "Location of Mercurial binary.",
|
||||
"pythonBinary": "Python Binary",
|
||||
"pythonBinaryHelpText": "Location of Python binary.",
|
||||
"pythonPath": "Python Module Search Path",
|
||||
"pythonPathHelpText": "Python Module Search Path (PYTHONPATH).",
|
||||
"repositoryDirectory": "Repository directory",
|
||||
"repositoryDirectoryHelpText": "Location of Mercurial repositories.",
|
||||
"encoding": "Encoding",
|
||||
"encodingHelpText": "Repository Encoding.",
|
||||
"useOptimizedBytecode": "Optimized Bytecode (.pyo)",
|
||||
"useOptimizedBytecodeHelpText": "Use the Python '-O' switch.",
|
||||
"showRevisionInId": "Show Revision",
|
||||
"showRevisionInIdHelpText": "Show revision as part of the node id.",
|
||||
"disabled": "Disabled",
|
||||
"disabledHelpText": "Enable or disable the Mercurial plugin.",
|
||||
"required": "This configuration value is required"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,6 @@ import org.junit.Test;
|
||||
import sonia.scm.repository.Changeset;
|
||||
import sonia.scm.repository.ChangesetPagingResult;
|
||||
import sonia.scm.repository.Modifications;
|
||||
import sonia.scm.repository.RevisionNotFoundException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -151,7 +150,7 @@ public class HgLogCommandTest extends AbstractHgCommandTestBase
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCommit() throws IOException, RevisionNotFoundException {
|
||||
public void testGetCommit() throws IOException {
|
||||
HgLogCommand command = createComamnd();
|
||||
String revision = "a9bacaf1b7fa0cebfca71fed4e59ed69a6319427";
|
||||
Changeset c =
|
||||
|
||||
@@ -641,9 +641,9 @@
|
||||
version "0.0.2"
|
||||
resolved "https://registry.yarnpkg.com/@scm-manager/eslint-config/-/eslint-config-0.0.2.tgz#94cc8c3fb4f51f870b235893dc134fc6c423ae85"
|
||||
|
||||
"@scm-manager/ui-bundler@^0.0.17":
|
||||
version "0.0.17"
|
||||
resolved "https://registry.yarnpkg.com/@scm-manager/ui-bundler/-/ui-bundler-0.0.17.tgz#949b90ca57e4268be28fcf4975bd9622f60278bb"
|
||||
"@scm-manager/ui-bundler@^0.0.21":
|
||||
version "0.0.21"
|
||||
resolved "https://registry.yarnpkg.com/@scm-manager/ui-bundler/-/ui-bundler-0.0.21.tgz#f8b5fa355415cc67b8aaf8744e1701a299dff647"
|
||||
dependencies:
|
||||
"@babel/core" "^7.0.0"
|
||||
"@babel/plugin-proposal-class-properties" "^7.0.0"
|
||||
@@ -681,9 +681,9 @@
|
||||
vinyl-source-stream "^2.0.0"
|
||||
watchify "^3.11.0"
|
||||
|
||||
"@scm-manager/ui-extensions@^0.0.7":
|
||||
version "0.0.7"
|
||||
resolved "https://registry.yarnpkg.com/@scm-manager/ui-extensions/-/ui-extensions-0.0.7.tgz#a0a657a1410b78838ba0b36096ef631dca7fe27e"
|
||||
"@scm-manager/ui-extensions@^0.1.1":
|
||||
version "0.1.1"
|
||||
resolved "https://registry.yarnpkg.com/@scm-manager/ui-extensions/-/ui-extensions-0.1.1.tgz#966e62d89981e92a14adf7e674e646e76de96d45"
|
||||
dependencies:
|
||||
react "^16.4.2"
|
||||
react-dom "^16.4.2"
|
||||
|
||||
@@ -23,4 +23,19 @@
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
<plugin>
|
||||
<groupId>sonia.scm.maven</groupId>
|
||||
<artifactId>smp-maven-plugin</artifactId>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<corePlugin>true</corePlugin>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
|
||||
@@ -4,5 +4,6 @@
|
||||
[include]
|
||||
|
||||
[libs]
|
||||
./node_modules/@scm-manager/ui-components/flow-typed
|
||||
|
||||
[options]
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
// flow-typed signature: cf86673cc32d185bdab1d2ea90578d37
|
||||
// flow-typed version: 614bf49aa8/classnames_v2.x.x/flow_>=v0.25.x
|
||||
|
||||
type $npm$classnames$Classes =
|
||||
| string
|
||||
| { [className: string]: * }
|
||||
| false
|
||||
| void
|
||||
| null;
|
||||
|
||||
declare module "classnames" {
|
||||
declare module.exports: (
|
||||
...classes: Array<$npm$classnames$Classes | $npm$classnames$Classes[]>
|
||||
) => string;
|
||||
}
|
||||
|
||||
declare module "classnames/bind" {
|
||||
declare module.exports: $Exports<"classnames">;
|
||||
}
|
||||
|
||||
declare module "classnames/dedupe" {
|
||||
declare module.exports: $Exports<"classnames">;
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,331 +0,0 @@
|
||||
// flow-typed signature: 23b805356f90ad9384dd88489654e380
|
||||
// flow-typed version: e9374c5fe9/moment_v2.3.x/flow_>=v0.25.x
|
||||
|
||||
type moment$MomentOptions = {
|
||||
y?: number | string,
|
||||
year?: number | string,
|
||||
years?: number | string,
|
||||
M?: number | string,
|
||||
month?: number | string,
|
||||
months?: number | string,
|
||||
d?: number | string,
|
||||
day?: number | string,
|
||||
days?: number | string,
|
||||
date?: number | string,
|
||||
h?: number | string,
|
||||
hour?: number | string,
|
||||
hours?: number | string,
|
||||
m?: number | string,
|
||||
minute?: number | string,
|
||||
minutes?: number | string,
|
||||
s?: number | string,
|
||||
second?: number | string,
|
||||
seconds?: number | string,
|
||||
ms?: number | string,
|
||||
millisecond?: number | string,
|
||||
milliseconds?: number | string
|
||||
};
|
||||
|
||||
type moment$MomentObject = {
|
||||
years: number,
|
||||
months: number,
|
||||
date: number,
|
||||
hours: number,
|
||||
minutes: number,
|
||||
seconds: number,
|
||||
milliseconds: number
|
||||
};
|
||||
|
||||
type moment$MomentCreationData = {
|
||||
input: string,
|
||||
format: string,
|
||||
locale: Object,
|
||||
isUTC: boolean,
|
||||
strict: boolean
|
||||
};
|
||||
|
||||
type moment$CalendarFormat = string | ((moment: moment$Moment) => string);
|
||||
|
||||
type moment$CalendarFormats = {
|
||||
sameDay?: moment$CalendarFormat,
|
||||
nextDay?: moment$CalendarFormat,
|
||||
nextWeek?: moment$CalendarFormat,
|
||||
lastDay?: moment$CalendarFormat,
|
||||
lastWeek?: moment$CalendarFormat,
|
||||
sameElse?: moment$CalendarFormat
|
||||
};
|
||||
|
||||
declare class moment$LocaleData {
|
||||
months(moment: moment$Moment): string,
|
||||
monthsShort(moment: moment$Moment): string,
|
||||
monthsParse(month: string): number,
|
||||
weekdays(moment: moment$Moment): string,
|
||||
weekdaysShort(moment: moment$Moment): string,
|
||||
weekdaysMin(moment: moment$Moment): string,
|
||||
weekdaysParse(weekDay: string): number,
|
||||
longDateFormat(dateFormat: string): string,
|
||||
isPM(date: string): boolean,
|
||||
meridiem(hours: number, minutes: number, isLower: boolean): string,
|
||||
calendar(
|
||||
key:
|
||||
| "sameDay"
|
||||
| "nextDay"
|
||||
| "lastDay"
|
||||
| "nextWeek"
|
||||
| "prevWeek"
|
||||
| "sameElse",
|
||||
moment: moment$Moment
|
||||
): string,
|
||||
relativeTime(
|
||||
number: number,
|
||||
withoutSuffix: boolean,
|
||||
key: "s" | "m" | "mm" | "h" | "hh" | "d" | "dd" | "M" | "MM" | "y" | "yy",
|
||||
isFuture: boolean
|
||||
): string,
|
||||
pastFuture(diff: any, relTime: string): string,
|
||||
ordinal(number: number): string,
|
||||
preparse(str: string): any,
|
||||
postformat(str: string): any,
|
||||
week(moment: moment$Moment): string,
|
||||
invalidDate(): string,
|
||||
firstDayOfWeek(): number,
|
||||
firstDayOfYear(): number
|
||||
}
|
||||
declare class moment$MomentDuration {
|
||||
humanize(suffix?: boolean): string,
|
||||
milliseconds(): number,
|
||||
asMilliseconds(): number,
|
||||
seconds(): number,
|
||||
asSeconds(): number,
|
||||
minutes(): number,
|
||||
asMinutes(): number,
|
||||
hours(): number,
|
||||
asHours(): number,
|
||||
days(): number,
|
||||
asDays(): number,
|
||||
months(): number,
|
||||
asWeeks(): number,
|
||||
weeks(): number,
|
||||
asMonths(): number,
|
||||
years(): number,
|
||||
asYears(): number,
|
||||
add(value: number | moment$MomentDuration | Object, unit?: string): this,
|
||||
subtract(value: number | moment$MomentDuration | Object, unit?: string): this,
|
||||
as(unit: string): number,
|
||||
get(unit: string): number,
|
||||
toJSON(): string,
|
||||
toISOString(): string,
|
||||
isValid(): boolean
|
||||
}
|
||||
declare class moment$Moment {
|
||||
static ISO_8601: string,
|
||||
static (
|
||||
string?: string,
|
||||
format?: string | Array<string>,
|
||||
strict?: boolean
|
||||
): moment$Moment,
|
||||
static (
|
||||
string?: string,
|
||||
format?: string | Array<string>,
|
||||
locale?: string,
|
||||
strict?: boolean
|
||||
): moment$Moment,
|
||||
static (
|
||||
initDate: ?Object | number | Date | Array<number> | moment$Moment | string
|
||||
): moment$Moment,
|
||||
static unix(seconds: number): moment$Moment,
|
||||
static utc(): moment$Moment,
|
||||
static utc(number: number | Array<number>): moment$Moment,
|
||||
static utc(
|
||||
str: string,
|
||||
str2?: string | Array<string>,
|
||||
str3?: string
|
||||
): moment$Moment,
|
||||
static utc(moment: moment$Moment): moment$Moment,
|
||||
static utc(date: Date): moment$Moment,
|
||||
static parseZone(): moment$Moment,
|
||||
static parseZone(rawDate: string): moment$Moment,
|
||||
static parseZone(
|
||||
rawDate: string,
|
||||
format: string | Array<string>
|
||||
): moment$Moment,
|
||||
static parseZone(
|
||||
rawDate: string,
|
||||
format: string,
|
||||
strict: boolean
|
||||
): moment$Moment,
|
||||
static parseZone(
|
||||
rawDate: string,
|
||||
format: string,
|
||||
locale: string,
|
||||
strict: boolean
|
||||
): moment$Moment,
|
||||
isValid(): boolean,
|
||||
invalidAt(): 0 | 1 | 2 | 3 | 4 | 5 | 6,
|
||||
creationData(): moment$MomentCreationData,
|
||||
millisecond(number: number): this,
|
||||
milliseconds(number: number): this,
|
||||
millisecond(): number,
|
||||
milliseconds(): number,
|
||||
second(number: number): this,
|
||||
seconds(number: number): this,
|
||||
second(): number,
|
||||
seconds(): number,
|
||||
minute(number: number): this,
|
||||
minutes(number: number): this,
|
||||
minute(): number,
|
||||
minutes(): number,
|
||||
hour(number: number): this,
|
||||
hours(number: number): this,
|
||||
hour(): number,
|
||||
hours(): number,
|
||||
date(number: number): this,
|
||||
dates(number: number): this,
|
||||
date(): number,
|
||||
dates(): number,
|
||||
day(day: number | string): this,
|
||||
days(day: number | string): this,
|
||||
day(): number,
|
||||
days(): number,
|
||||
weekday(number: number): this,
|
||||
weekday(): number,
|
||||
isoWeekday(number: number): this,
|
||||
isoWeekday(): number,
|
||||
dayOfYear(number: number): this,
|
||||
dayOfYear(): number,
|
||||
week(number: number): this,
|
||||
weeks(number: number): this,
|
||||
week(): number,
|
||||
weeks(): number,
|
||||
isoWeek(number: number): this,
|
||||
isoWeeks(number: number): this,
|
||||
isoWeek(): number,
|
||||
isoWeeks(): number,
|
||||
month(number: number): this,
|
||||
months(number: number): this,
|
||||
month(): number,
|
||||
months(): number,
|
||||
quarter(number: number): this,
|
||||
quarter(): number,
|
||||
year(number: number): this,
|
||||
years(number: number): this,
|
||||
year(): number,
|
||||
years(): number,
|
||||
weekYear(number: number): this,
|
||||
weekYear(): number,
|
||||
isoWeekYear(number: number): this,
|
||||
isoWeekYear(): number,
|
||||
weeksInYear(): number,
|
||||
isoWeeksInYear(): number,
|
||||
get(string: string): number,
|
||||
set(unit: string, value: number): this,
|
||||
set(options: { [unit: string]: number }): this,
|
||||
static max(...dates: Array<moment$Moment>): moment$Moment,
|
||||
static max(dates: Array<moment$Moment>): moment$Moment,
|
||||
static min(...dates: Array<moment$Moment>): moment$Moment,
|
||||
static min(dates: Array<moment$Moment>): moment$Moment,
|
||||
add(
|
||||
value: number | moment$MomentDuration | moment$Moment | Object,
|
||||
unit?: string
|
||||
): this,
|
||||
subtract(
|
||||
value: number | moment$MomentDuration | moment$Moment | string | Object,
|
||||
unit?: string
|
||||
): this,
|
||||
startOf(unit: string): this,
|
||||
endOf(unit: string): this,
|
||||
local(): this,
|
||||
utc(): this,
|
||||
utcOffset(
|
||||
offset: number | string,
|
||||
keepLocalTime?: boolean,
|
||||
keepMinutes?: boolean
|
||||
): this,
|
||||
utcOffset(): number,
|
||||
format(format?: string): string,
|
||||
fromNow(removeSuffix?: boolean): string,
|
||||
from(
|
||||
value: moment$Moment | string | number | Date | Array<number>,
|
||||
removePrefix?: boolean
|
||||
): string,
|
||||
toNow(removePrefix?: boolean): string,
|
||||
to(
|
||||
value: moment$Moment | string | number | Date | Array<number>,
|
||||
removePrefix?: boolean
|
||||
): string,
|
||||
calendar(refTime?: any, formats?: moment$CalendarFormats): string,
|
||||
diff(
|
||||
date: moment$Moment | string | number | Date | Array<number>,
|
||||
format?: string,
|
||||
floating?: boolean
|
||||
): number,
|
||||
valueOf(): number,
|
||||
unix(): number,
|
||||
daysInMonth(): number,
|
||||
toDate(): Date,
|
||||
toArray(): Array<number>,
|
||||
toJSON(): string,
|
||||
toISOString(
|
||||
keepOffset?: boolean
|
||||
): string,
|
||||
toObject(): moment$MomentObject,
|
||||
isBefore(
|
||||
date?: moment$Moment | string | number | Date | Array<number>,
|
||||
units?: ?string
|
||||
): boolean,
|
||||
isSame(
|
||||
date?: moment$Moment | string | number | Date | Array<number>,
|
||||
units?: ?string
|
||||
): boolean,
|
||||
isAfter(
|
||||
date?: moment$Moment | string | number | Date | Array<number>,
|
||||
units?: ?string
|
||||
): boolean,
|
||||
isSameOrBefore(
|
||||
date?: moment$Moment | string | number | Date | Array<number>,
|
||||
units?: ?string
|
||||
): boolean,
|
||||
isSameOrAfter(
|
||||
date?: moment$Moment | string | number | Date | Array<number>,
|
||||
units?: ?string
|
||||
): boolean,
|
||||
isBetween(
|
||||
fromDate: moment$Moment | string | number | Date | Array<number>,
|
||||
toDate?: ?moment$Moment | string | number | Date | Array<number>,
|
||||
granularity?: ?string,
|
||||
inclusion?: ?string
|
||||
): boolean,
|
||||
isDST(): boolean,
|
||||
isDSTShifted(): boolean,
|
||||
isLeapYear(): boolean,
|
||||
clone(): moment$Moment,
|
||||
static isMoment(obj: any): boolean,
|
||||
static isDate(obj: any): boolean,
|
||||
static locale(locale: string, localeData?: Object): string,
|
||||
static updateLocale(locale: string, localeData?: ?Object): void,
|
||||
static locale(locales: Array<string>): string,
|
||||
locale(locale: string, customization?: Object | null): moment$Moment,
|
||||
locale(): string,
|
||||
static months(): Array<string>,
|
||||
static monthsShort(): Array<string>,
|
||||
static weekdays(): Array<string>,
|
||||
static weekdaysShort(): Array<string>,
|
||||
static weekdaysMin(): Array<string>,
|
||||
static months(): string,
|
||||
static monthsShort(): string,
|
||||
static weekdays(): string,
|
||||
static weekdaysShort(): string,
|
||||
static weekdaysMin(): string,
|
||||
static localeData(key?: string): moment$LocaleData,
|
||||
static duration(
|
||||
value: number | Object | string,
|
||||
unit?: string
|
||||
): moment$MomentDuration,
|
||||
static isDuration(obj: any): boolean,
|
||||
static normalizeUnits(unit: string): string,
|
||||
static invalid(object: any): moment$Moment
|
||||
}
|
||||
|
||||
declare module "moment" {
|
||||
declare module.exports: Class<moment$Moment>;
|
||||
}
|
||||
@@ -1,137 +0,0 @@
|
||||
// flow-typed signature: ba35d02d668b0d0a3e04a63a6847974e
|
||||
// flow-typed version: <<STUB>>/react-jss_v8.6.1/flow_v0.79.1
|
||||
|
||||
/**
|
||||
* This is an autogenerated libdef stub for:
|
||||
*
|
||||
* 'react-jss'
|
||||
*
|
||||
* Fill this stub out by replacing all the `any` types.
|
||||
*
|
||||
* Once filled out, we encourage you to share your work with the
|
||||
* community by sending a pull request to:
|
||||
* https://github.com/flowtype/flow-typed
|
||||
*/
|
||||
|
||||
declare module 'react-jss' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
/**
|
||||
* We include stubs for each file inside this npm package in case you need to
|
||||
* require those files directly. Feel free to delete any files that aren't
|
||||
* needed.
|
||||
*/
|
||||
declare module 'react-jss/dist/react-jss' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/dist/react-jss.min' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/compose' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/compose.test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/contextTypes' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/createHoc' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/getDisplayName' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/index' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/index.test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/injectSheet' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/injectSheet.test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/jss' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/JssProvider' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/JssProvider.test' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/ns' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
declare module 'react-jss/lib/propTypes' {
|
||||
declare module.exports: any;
|
||||
}
|
||||
|
||||
// Filename aliases
|
||||
declare module 'react-jss/dist/react-jss.js' {
|
||||
declare module.exports: $Exports<'react-jss/dist/react-jss'>;
|
||||
}
|
||||
declare module 'react-jss/dist/react-jss.min.js' {
|
||||
declare module.exports: $Exports<'react-jss/dist/react-jss.min'>;
|
||||
}
|
||||
declare module 'react-jss/lib/compose.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/compose'>;
|
||||
}
|
||||
declare module 'react-jss/lib/compose.test.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/compose.test'>;
|
||||
}
|
||||
declare module 'react-jss/lib/contextTypes.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/contextTypes'>;
|
||||
}
|
||||
declare module 'react-jss/lib/createHoc.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/createHoc'>;
|
||||
}
|
||||
declare module 'react-jss/lib/getDisplayName.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/getDisplayName'>;
|
||||
}
|
||||
declare module 'react-jss/lib/index.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/index'>;
|
||||
}
|
||||
declare module 'react-jss/lib/index.test.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/index.test'>;
|
||||
}
|
||||
declare module 'react-jss/lib/injectSheet.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/injectSheet'>;
|
||||
}
|
||||
declare module 'react-jss/lib/injectSheet.test.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/injectSheet.test'>;
|
||||
}
|
||||
declare module 'react-jss/lib/jss.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/jss'>;
|
||||
}
|
||||
declare module 'react-jss/lib/JssProvider.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/JssProvider'>;
|
||||
}
|
||||
declare module 'react-jss/lib/JssProvider.test.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/JssProvider.test'>;
|
||||
}
|
||||
declare module 'react-jss/lib/ns.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/ns'>;
|
||||
}
|
||||
declare module 'react-jss/lib/propTypes.js' {
|
||||
declare module.exports: $Exports<'react-jss/lib/propTypes'>;
|
||||
}
|
||||
@@ -6,9 +6,9 @@
|
||||
"build": "ui-bundler plugin"
|
||||
},
|
||||
"dependencies": {
|
||||
"@scm-manager/ui-extensions": "^0.0.7"
|
||||
"@scm-manager/ui-extensions": "^0.1.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@scm-manager/ui-bundler": "^0.0.17"
|
||||
"@scm-manager/ui-bundler": "^0.0.21"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
|
||||
<parent>
|
||||
<artifactId>scm-plugins</artifactId>
|
||||
<groupId>sonia.scm.plugins</groupId>
|
||||
@@ -28,7 +28,7 @@
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>sonia.svnkit</groupId>
|
||||
<artifactId>svnkit-dav</artifactId>
|
||||
@@ -36,12 +36,24 @@
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<!-- create test jar -->
|
||||
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
|
||||
|
||||
<plugin>
|
||||
<groupId>sonia.scm.maven</groupId>
|
||||
<artifactId>smp-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<corePlugin>true</corePlugin>
|
||||
<links>
|
||||
<link>@scm-manager/ui-types</link>
|
||||
<link>@scm-manager/ui-components</link>
|
||||
</links>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!-- create test jar -->
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
@@ -55,51 +67,23 @@
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<plugin>
|
||||
<groupId>com.github.sdorra</groupId>
|
||||
<artifactId>buildfrontend-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>link-ui-types</id>
|
||||
<phase>process-sources</phase>
|
||||
<goals>
|
||||
<goal>install-link</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<pkg>@scm-manager/ui-types</pkg>
|
||||
</configuration>
|
||||
</execution>
|
||||
<execution>
|
||||
<id>link-ui-components</id>
|
||||
<phase>process-sources</phase>
|
||||
<goals>
|
||||
<goal>install-link</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<pkg>@scm-manager/ui-components</pkg>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<repositories>
|
||||
|
||||
|
||||
<repository>
|
||||
<id>maven.tmatesoft.com</id>
|
||||
<name>tmatesoft release repository</name>
|
||||
<url>https://maven.tmatesoft.com/content/repositories/releases</url>
|
||||
</repository>
|
||||
|
||||
|
||||
<repository>
|
||||
<id>maven.scm-manager.org</id>
|
||||
<name>scm-manager release repository</name>
|
||||
<url>http://maven.scm-manager.org/nexus/content/groups/public</url>
|
||||
</repository>
|
||||
|
||||
|
||||
</repositories>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
/**
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
* DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANY
|
||||
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
package sonia.scm.api.rest.resources;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Singleton;
|
||||
|
||||
import sonia.scm.repository.RepositoryManager;
|
||||
import sonia.scm.repository.SvnConfig;
|
||||
import sonia.scm.repository.SvnRepositoryHandler;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.POST;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Context;
|
||||
import javax.ws.rs.core.MediaType;
|
||||
import javax.ws.rs.core.Response;
|
||||
import javax.ws.rs.core.UriInfo;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
@Singleton
|
||||
@Path("config/repositories/svn")
|
||||
@Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
public class SvnConfigResource
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructs ...
|
||||
*
|
||||
*
|
||||
* @param repositoryManager
|
||||
*/
|
||||
@Inject
|
||||
public SvnConfigResource(RepositoryManager repositoryManager)
|
||||
{
|
||||
repositoryHandler = (SvnRepositoryHandler) repositoryManager.getHandler(
|
||||
SvnRepositoryHandler.TYPE_NAME);
|
||||
}
|
||||
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GET
|
||||
public SvnConfig getConfig()
|
||||
{
|
||||
SvnConfig config = repositoryHandler.getConfig();
|
||||
|
||||
if (config == null)
|
||||
{
|
||||
config = new SvnConfig();
|
||||
repositoryHandler.setConfig(config);
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
//~--- set methods ----------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Method description
|
||||
*
|
||||
*
|
||||
* @param uriInfo
|
||||
* @param config
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Consumes({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML })
|
||||
public Response setConfig(@Context UriInfo uriInfo, SvnConfig config)
|
||||
{
|
||||
repositoryHandler.setConfig(config);
|
||||
repositoryHandler.storeConfig();
|
||||
|
||||
return Response.created(uriInfo.getRequestUri()).build();
|
||||
}
|
||||
|
||||
//~--- fields ---------------------------------------------------------------
|
||||
|
||||
/** Field description */
|
||||
private SvnRepositoryHandler repositoryHandler;
|
||||
}
|
||||
@@ -56,6 +56,8 @@ import sonia.scm.util.Util;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import static sonia.scm.ContextEntry.ContextBuilder.entity;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
@@ -173,7 +175,8 @@ public class SvnRepositoryHandler
|
||||
}
|
||||
catch (SVNException ex)
|
||||
{
|
||||
throw new InternalRepositoryException(ex);
|
||||
logger.error("could not create svn repository", ex);
|
||||
throw new InternalRepositoryException(entity(repository), "could not create repository", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -59,6 +59,9 @@ import java.io.PrintWriter;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static sonia.scm.ContextEntry.ContextBuilder.entity;
|
||||
import static sonia.scm.NotFoundException.notFound;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
@@ -102,7 +105,7 @@ public final class SvnUtil
|
||||
|
||||
//~--- methods --------------------------------------------------------------
|
||||
|
||||
public static long parseRevision(String v) throws RevisionNotFoundException {
|
||||
public static long parseRevision(String v, Repository repository) {
|
||||
long result = -1l;
|
||||
|
||||
if (!Strings.isNullOrEmpty(v))
|
||||
@@ -113,7 +116,7 @@ public final class SvnUtil
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
throw new RevisionNotFoundException(v);
|
||||
throw notFound(entity("Revision", v).in(repository));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -339,7 +342,7 @@ public final class SvnUtil
|
||||
}
|
||||
}
|
||||
|
||||
public static long getRevisionNumber(String revision) throws RevisionNotFoundException {
|
||||
public static long getRevisionNumber(String revision, Repository repository) {
|
||||
// REVIEW Bei SVN wird ohne Revision die -1 genommen, was zu einem Fehler führt
|
||||
long revisionNumber = -1;
|
||||
|
||||
@@ -351,7 +354,7 @@ public final class SvnUtil
|
||||
}
|
||||
catch (NumberFormatException ex)
|
||||
{
|
||||
throw new RevisionNotFoundException(revision);
|
||||
throw notFound(entity("Revision", revision).in(repository));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -98,7 +98,7 @@ public class SvnBlameCommand extends AbstractSvnCommand implements BlameCommand
|
||||
}
|
||||
catch (SVNException ex)
|
||||
{
|
||||
throw new InternalRepositoryException("could not create blame result", ex);
|
||||
throw new InternalRepositoryException(repository, "could not create blame result", ex);
|
||||
}
|
||||
|
||||
return new BlameResult(blameLines.size(), blameLines);
|
||||
|
||||
@@ -48,7 +48,6 @@ import org.tmatesoft.svn.core.io.SVNRepository;
|
||||
import sonia.scm.repository.BrowserResult;
|
||||
import sonia.scm.repository.FileObject;
|
||||
import sonia.scm.repository.Repository;
|
||||
import sonia.scm.repository.RevisionNotFoundException;
|
||||
import sonia.scm.repository.SubRepository;
|
||||
import sonia.scm.repository.SvnUtil;
|
||||
import sonia.scm.util.Util;
|
||||
@@ -79,9 +78,9 @@ public class SvnBrowseCommand extends AbstractSvnCommand
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public BrowserResult getBrowserResult(BrowseCommandRequest request) throws RevisionNotFoundException {
|
||||
public BrowserResult getBrowserResult(BrowseCommandRequest request) {
|
||||
String path = Strings.nullToEmpty(request.getPath());
|
||||
long revisionNumber = SvnUtil.getRevisionNumber(request.getRevision());
|
||||
long revisionNumber = SvnUtil.getRevisionNumber(request.getRevision(), repository);
|
||||
|
||||
if (logger.isDebugEnabled()) {
|
||||
logger.debug("browser repository {} in path \"{}\" at revision {}", repository.getName(), path, revisionNumber);
|
||||
|
||||
@@ -44,9 +44,7 @@ import org.tmatesoft.svn.core.io.SVNRepository;
|
||||
import org.tmatesoft.svn.core.wc.SVNClientManager;
|
||||
import org.tmatesoft.svn.core.wc.admin.SVNLookClient;
|
||||
import sonia.scm.repository.InternalRepositoryException;
|
||||
import sonia.scm.repository.PathNotFoundException;
|
||||
import sonia.scm.repository.Repository;
|
||||
import sonia.scm.repository.RevisionNotFoundException;
|
||||
import sonia.scm.repository.SvnUtil;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
@@ -54,6 +52,9 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
|
||||
import static sonia.scm.ContextEntry.ContextBuilder.entity;
|
||||
import static sonia.scm.NotFoundException.notFound;
|
||||
|
||||
//~--- JDK imports ------------------------------------------------------------
|
||||
|
||||
/**
|
||||
@@ -79,7 +80,7 @@ public class SvnCatCommand extends AbstractSvnCommand implements CatCommand
|
||||
//~--- get methods ----------------------------------------------------------
|
||||
|
||||
@Override
|
||||
public void getCatResult(CatCommandRequest request, OutputStream output) throws RevisionNotFoundException, PathNotFoundException {
|
||||
public void getCatResult(CatCommandRequest request, OutputStream output) {
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("try to get content for {}", request);
|
||||
@@ -96,14 +97,14 @@ public class SvnCatCommand extends AbstractSvnCommand implements CatCommand
|
||||
else
|
||||
{
|
||||
|
||||
long revisionNumber = SvnUtil.getRevisionNumber(revision);
|
||||
long revisionNumber = SvnUtil.getRevisionNumber(revision, repository);
|
||||
|
||||
getCatFromRevision(request, output, revisionNumber);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public InputStream getCatResultStream(CatCommandRequest request) throws RevisionNotFoundException, PathNotFoundException {
|
||||
public InputStream getCatResultStream(CatCommandRequest request) {
|
||||
// There seems to be no method creating an input stream as a result, so
|
||||
// we have no other possibility then to copy the content into a buffer and
|
||||
// stream it from there.
|
||||
@@ -112,7 +113,7 @@ public class SvnCatCommand extends AbstractSvnCommand implements CatCommand
|
||||
return new ByteArrayInputStream(output.toByteArray());
|
||||
}
|
||||
|
||||
private void getCatFromRevision(CatCommandRequest request, OutputStream output, long revision) throws PathNotFoundException, RevisionNotFoundException {
|
||||
private void getCatFromRevision(CatCommandRequest request, OutputStream output, long revision) {
|
||||
logger.debug("try to read content from revision {} and path {}", revision,
|
||||
request.getPath());
|
||||
|
||||
@@ -129,14 +130,14 @@ public class SvnCatCommand extends AbstractSvnCommand implements CatCommand
|
||||
}
|
||||
}
|
||||
|
||||
private void handleSvnException(CatCommandRequest request, SVNException ex) throws PathNotFoundException, RevisionNotFoundException {
|
||||
private void handleSvnException(CatCommandRequest request, SVNException ex) {
|
||||
int svnErrorCode = ex.getErrorMessage().getErrorCode().getCode();
|
||||
if (SVNErrorCode.FS_NOT_FOUND.getCode() == svnErrorCode) {
|
||||
throw new PathNotFoundException(request.getPath());
|
||||
throw notFound(entity("Path", request.getPath()).in("Revision", request.getRevision()).in(repository));
|
||||
} else if (SVNErrorCode.FS_NO_SUCH_REVISION.getCode() == svnErrorCode) {
|
||||
throw new RevisionNotFoundException(request.getRevision());
|
||||
throw notFound(entity("Revision", request.getRevision()).in(repository));
|
||||
} else {
|
||||
throw new InternalRepositoryException("could not get content from revision", ex);
|
||||
throw new InternalRepositoryException(repository, "could not get content from revision", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,7 +157,7 @@ public class SvnCatCommand extends AbstractSvnCommand implements CatCommand
|
||||
}
|
||||
catch (SVNException ex)
|
||||
{
|
||||
throw new InternalRepositoryException("could not get content from transaction", ex);
|
||||
throw new InternalRepositoryException(repository, "could not get content from transaction", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
/**
|
||||
/*
|
||||
* Copyright (c) 2010, Sebastian Sdorra
|
||||
* All rights reserved.
|
||||
*
|
||||
* <p>
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* <p>
|
||||
* 1. Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* this list of conditions and the following disclaimer in the documentation
|
||||
* and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of SCM-Manager; nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
*
|
||||
* contributors may be used to endorse or promote products derived from this
|
||||
* software without specific prior written permission.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
@@ -24,13 +24,11 @@
|
||||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* <p>
|
||||
* http://bitbucket.org/sdorra/scm-manager
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
//~--- non-JDK imports --------------------------------------------------------
|
||||
@@ -41,14 +39,12 @@ import org.slf4j.LoggerFactory;
|
||||
import org.tmatesoft.svn.core.SVNDepth;
|
||||
import org.tmatesoft.svn.core.SVNException;
|
||||
import org.tmatesoft.svn.core.SVNURL;
|
||||
import org.tmatesoft.svn.core.wc.DefaultSVNDiffGenerator;
|
||||
import org.tmatesoft.svn.core.wc.ISVNDiffGenerator;
|
||||
import org.tmatesoft.svn.core.internal.wc2.ng.SvnNewDiffGenerator;
|
||||
import org.tmatesoft.svn.core.wc.SVNClientManager;
|
||||
import org.tmatesoft.svn.core.wc.SVNDiffClient;
|
||||
import org.tmatesoft.svn.core.wc.SVNRevision;
|
||||
import sonia.scm.repository.InternalRepositoryException;
|
||||
import sonia.scm.repository.Repository;
|
||||
import sonia.scm.repository.RevisionNotFoundException;
|
||||
import sonia.scm.repository.SvnUtil;
|
||||
import sonia.scm.repository.api.DiffFormat;
|
||||
import sonia.scm.util.Util;
|
||||
@@ -61,8 +57,7 @@ import java.io.OutputStream;
|
||||
*
|
||||
* @author Sebastian Sdorra
|
||||
*/
|
||||
public class SvnDiffCommand extends AbstractSvnCommand implements DiffCommand
|
||||
{
|
||||
public class SvnDiffCommand extends AbstractSvnCommand implements DiffCommand {
|
||||
|
||||
/**
|
||||
* the logger for SvnDiffCommand
|
||||
@@ -70,61 +65,37 @@ public class SvnDiffCommand extends AbstractSvnCommand implements DiffCommand
|
||||
private static final Logger logger =
|
||||
LoggerFactory.getLogger(SvnDiffCommand.class);
|
||||
|
||||
public SvnDiffCommand(SvnContext context, Repository repository)
|
||||
{
|
||||
public SvnDiffCommand(SvnContext context, Repository repository) {
|
||||
super(context, repository);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getDiffResult(DiffCommandRequest request, OutputStream output) throws RevisionNotFoundException {
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("create diff for {}", request);
|
||||
}
|
||||
|
||||
public void getDiffResult(DiffCommandRequest request, OutputStream output) {
|
||||
logger.debug("create diff for {}", request);
|
||||
Preconditions.checkNotNull(request, "request is required");
|
||||
Preconditions.checkNotNull(output, "outputstream is required");
|
||||
|
||||
String path = request.getPath();
|
||||
SVNClientManager clientManager = null;
|
||||
|
||||
try
|
||||
{
|
||||
try {
|
||||
SVNURL svnurl = context.createUrl();
|
||||
|
||||
if (Util.isNotEmpty(path))
|
||||
{
|
||||
if (Util.isNotEmpty(path)) {
|
||||
svnurl = svnurl.appendPath(path, true);
|
||||
}
|
||||
|
||||
clientManager = SVNClientManager.newInstance();
|
||||
|
||||
SVNDiffClient diffClient = clientManager.getDiffClient();
|
||||
ISVNDiffGenerator diffGenerator = diffClient.getDiffGenerator();
|
||||
diffClient.setDiffGenerator(new SvnNewDiffGenerator(new SCMSvnDiffGenerator()));
|
||||
|
||||
if (diffGenerator == null)
|
||||
{
|
||||
diffGenerator = new DefaultSVNDiffGenerator();
|
||||
}
|
||||
|
||||
diffGenerator.setDiffAdded(true);
|
||||
diffGenerator.setDiffDeleted(true);
|
||||
diffClient.setDiffGenerator(diffGenerator);
|
||||
|
||||
long currentRev = SvnUtil.getRevisionNumber(request.getRevision());
|
||||
long currentRev = SvnUtil.getRevisionNumber(request.getRevision(), repository);
|
||||
|
||||
diffClient.setGitDiffFormat(request.getFormat() == DiffFormat.GIT);
|
||||
|
||||
diffClient.doDiff(svnurl, SVNRevision.HEAD,
|
||||
SVNRevision.create(currentRev - 1), SVNRevision.create(currentRev),
|
||||
SVNDepth.INFINITY, false, output);
|
||||
}
|
||||
catch (SVNException ex)
|
||||
{
|
||||
throw new InternalRepositoryException("could not create diff", ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
} catch (SVNException ex) {
|
||||
throw new InternalRepositoryException(repository, "could not create diff", ex);
|
||||
} finally {
|
||||
SvnUtil.dispose(clientManager);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,6 @@ import sonia.scm.repository.Changeset;
|
||||
import sonia.scm.repository.ChangesetPagingResult;
|
||||
import sonia.scm.repository.InternalRepositoryException;
|
||||
import sonia.scm.repository.Repository;
|
||||
import sonia.scm.repository.RevisionNotFoundException;
|
||||
import sonia.scm.repository.SvnUtil;
|
||||
import sonia.scm.util.Util;
|
||||
|
||||
@@ -76,7 +75,7 @@ public class SvnLogCommand extends AbstractSvnCommand implements LogCommand
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Changeset getChangeset(String revision) throws RevisionNotFoundException {
|
||||
public Changeset getChangeset(String revision) {
|
||||
Changeset changeset = null;
|
||||
|
||||
if (logger.isDebugEnabled())
|
||||
@@ -86,7 +85,7 @@ public class SvnLogCommand extends AbstractSvnCommand implements LogCommand
|
||||
|
||||
try
|
||||
{
|
||||
long revisioNumber = parseRevision(revision);
|
||||
long revisioNumber = parseRevision(revision, repository);
|
||||
SVNRepository repo = open();
|
||||
Collection<SVNLogEntry> entries = repo.log(null, null, revisioNumber,
|
||||
revisioNumber, true, true);
|
||||
@@ -98,7 +97,7 @@ public class SvnLogCommand extends AbstractSvnCommand implements LogCommand
|
||||
}
|
||||
catch (SVNException ex)
|
||||
{
|
||||
throw new InternalRepositoryException("could not open repository", ex);
|
||||
throw new InternalRepositoryException(repository, "could not open repository", ex);
|
||||
}
|
||||
|
||||
return changeset;
|
||||
@@ -106,7 +105,7 @@ public class SvnLogCommand extends AbstractSvnCommand implements LogCommand
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public ChangesetPagingResult getChangesets(LogCommandRequest request) throws RevisionNotFoundException {
|
||||
public ChangesetPagingResult getChangesets(LogCommandRequest request) {
|
||||
if (logger.isDebugEnabled())
|
||||
{
|
||||
logger.debug("fetch changesets for {}", request);
|
||||
@@ -115,8 +114,8 @@ public class SvnLogCommand extends AbstractSvnCommand implements LogCommand
|
||||
ChangesetPagingResult changesets = null;
|
||||
int start = request.getPagingStart();
|
||||
int limit = request.getPagingLimit();
|
||||
long startRevision = parseRevision(request.getStartChangeset());
|
||||
long endRevision = parseRevision(request.getEndChangeset());
|
||||
long startRevision = parseRevision(request.getStartChangeset(), repository);
|
||||
long endRevision = parseRevision(request.getEndChangeset(), repository);
|
||||
String[] pathArray = null;
|
||||
|
||||
if (!Strings.isNullOrEmpty(request.getPath()))
|
||||
@@ -140,7 +139,7 @@ public class SvnLogCommand extends AbstractSvnCommand implements LogCommand
|
||||
}
|
||||
catch (SVNException ex)
|
||||
{
|
||||
throw new InternalRepositoryException("could not open repository", ex);
|
||||
throw new InternalRepositoryException(repository, "could not open repository", ex);
|
||||
}
|
||||
|
||||
return changesets;
|
||||
|
||||
@@ -7,11 +7,9 @@ import org.tmatesoft.svn.core.io.SVNRepository;
|
||||
import sonia.scm.repository.InternalRepositoryException;
|
||||
import sonia.scm.repository.Modifications;
|
||||
import sonia.scm.repository.Repository;
|
||||
import sonia.scm.repository.RevisionNotFoundException;
|
||||
import sonia.scm.repository.SvnUtil;
|
||||
import sonia.scm.util.Util;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
|
||||
@Slf4j
|
||||
@@ -24,11 +22,11 @@ public class SvnModificationsCommand extends AbstractSvnCommand implements Modif
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Modifications getModifications(String revision) throws IOException, RevisionNotFoundException {
|
||||
public Modifications getModifications(String revision) {
|
||||
Modifications modifications = null;
|
||||
log.debug("get modifications {}", revision);
|
||||
try {
|
||||
long revisionNumber = SvnUtil.parseRevision(revision);
|
||||
long revisionNumber = SvnUtil.parseRevision(revision, repository);
|
||||
SVNRepository repo = open();
|
||||
Collection<SVNLogEntry> entries = repo.log(null, null, revisionNumber,
|
||||
revisionNumber, true, true);
|
||||
@@ -36,13 +34,13 @@ public class SvnModificationsCommand extends AbstractSvnCommand implements Modif
|
||||
modifications = SvnUtil.createModifications(entries.iterator().next(), revision);
|
||||
}
|
||||
} catch (SVNException ex) {
|
||||
throw new InternalRepositoryException("could not open repository", ex);
|
||||
throw new InternalRepositoryException(repository, "could not open repository", ex);
|
||||
}
|
||||
return modifications;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Modifications getModifications(ModificationsCommandRequest request) throws IOException, RevisionNotFoundException {
|
||||
public Modifications getModifications(ModificationsCommandRequest request) {
|
||||
return getModifications(request.getRevision());
|
||||
}
|
||||
|
||||
|
||||
107
scm-plugins/scm-svn-plugin/src/main/js/SvnConfigurationForm.js
Normal file
107
scm-plugins/scm-svn-plugin/src/main/js/SvnConfigurationForm.js
Normal file
@@ -0,0 +1,107 @@
|
||||
//@flow
|
||||
import React from "react";
|
||||
import type { Links } from "@scm-manager/ui-types";
|
||||
import { translate } from "react-i18next";
|
||||
import { InputField, Checkbox, Select } from "@scm-manager/ui-components";
|
||||
|
||||
type Configuration = {
|
||||
repositoryDirectory: string,
|
||||
compatibility: string,
|
||||
enabledGZip: boolean,
|
||||
disabled: boolean,
|
||||
_links: Links
|
||||
};
|
||||
|
||||
type Props = {
|
||||
initialConfiguration: Configuration,
|
||||
readOnly: boolean,
|
||||
|
||||
onConfigurationChange: (Configuration, boolean) => void,
|
||||
|
||||
// context props
|
||||
t: (string) => string
|
||||
}
|
||||
|
||||
type State = Configuration;
|
||||
|
||||
class HgConfigurationForm extends React.Component<Props, State> {
|
||||
|
||||
constructor(props: Props) {
|
||||
super(props);
|
||||
this.state = { ...props.initialConfiguration, validationErrors: [] };
|
||||
}
|
||||
|
||||
isValid = () => {
|
||||
return !!this.state.repositoryDirectory;
|
||||
};
|
||||
|
||||
handleChange = (value: any, name: string) => {
|
||||
this.setState({
|
||||
[name]: value
|
||||
}, () => this.props.onConfigurationChange(this.state, this.isValid()));
|
||||
};
|
||||
|
||||
compatibilityOptions = (values: string[]) => {
|
||||
const options = [];
|
||||
for (let value of values) {
|
||||
options.push( this.compatibilityOption(value) );
|
||||
}
|
||||
return options;
|
||||
};
|
||||
|
||||
compatibilityOption = (value: string) => {
|
||||
return {
|
||||
value,
|
||||
label: this.props.t("scm-svn-plugin.config.compatibility-values." + value.toLowerCase())
|
||||
};
|
||||
};
|
||||
|
||||
render() {
|
||||
const { readOnly, t } = this.props;
|
||||
const compatibilityOptions = this.compatibilityOptions([
|
||||
"NONE", "PRE14", "PRE15", "PRE16", "PRE17", "WITH17"
|
||||
]);
|
||||
|
||||
return (
|
||||
<>
|
||||
<InputField
|
||||
name="repositoryDirectory"
|
||||
label={t("scm-svn-plugin.config.directory")}
|
||||
helpText={t("scm-svn-plugin.config.directoryHelpText")}
|
||||
value={this.state.repositoryDirectory}
|
||||
errorMessage={t("scm-svn-plugin.config.required")}
|
||||
validationError={!this.state.repositoryDirectory}
|
||||
onChange={this.handleChange}
|
||||
disabled={readOnly}
|
||||
/>
|
||||
<Select
|
||||
name="compatibility"
|
||||
label={t("scm-svn-plugin.config.compatibility")}
|
||||
helpText={t("scm-svn-plugin.config.compatibilityHelpText")}
|
||||
value={this.state.compatibility}
|
||||
options={compatibilityOptions}
|
||||
onChange={this.handleChange}
|
||||
/>
|
||||
<Checkbox
|
||||
name="enabledGZip"
|
||||
label={t("scm-svn-plugin.config.enabledGZip")}
|
||||
helpText={t("scm-svn-plugin.config.enabledGZipHelpText")}
|
||||
checked={this.state.enabledGZip}
|
||||
onChange={this.handleChange}
|
||||
disabled={readOnly}
|
||||
/>
|
||||
<Checkbox
|
||||
name="disabled"
|
||||
label={t("scm-svn-plugin.config.disabled")}
|
||||
helpText={t("scm-svn-plugin.config.disabledHelpText")}
|
||||
checked={this.state.disabled}
|
||||
onChange={this.handleChange}
|
||||
disabled={readOnly}
|
||||
/>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default translate("plugins")(HgConfigurationForm);
|
||||
@@ -0,0 +1,28 @@
|
||||
//@flow
|
||||
import React from "react";
|
||||
import { translate } from "react-i18next";
|
||||
import { Title, GlobalConfiguration } from "@scm-manager/ui-components";
|
||||
import SvnConfigurationForm from "./SvnConfigurationForm";
|
||||
|
||||
type Props = {
|
||||
link: string,
|
||||
|
||||
// context props
|
||||
t: (string) => string
|
||||
}
|
||||
|
||||
class SvnGlobalConfiguration extends React.Component<Props> {
|
||||
|
||||
render() {
|
||||
const { link, t } = this.props;
|
||||
return (
|
||||
<div>
|
||||
<Title title={t("scm-svn-plugin.config.title")}/>
|
||||
<GlobalConfiguration link={link} render={props => <SvnConfigurationForm {...props} />}/>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
export default translate("plugins")(SvnGlobalConfiguration);
|
||||
@@ -1,7 +1,9 @@
|
||||
// @flow
|
||||
import { binder } from "@scm-manager/ui-extensions";
|
||||
import { ConfigurationBinder as cfgBinder } from "@scm-manager/ui-components";
|
||||
import ProtocolInformation from "./ProtocolInformation";
|
||||
import SvnAvatar from "./SvnAvatar";
|
||||
import SvnGlobalConfiguration from "./SvnGlobalConfiguration";
|
||||
|
||||
const svnPredicate = (props: Object) => {
|
||||
return props.repository && props.repository.type === "svn";
|
||||
@@ -9,3 +11,7 @@ const svnPredicate = (props: Object) => {
|
||||
|
||||
binder.bind("repos.repository-details.information", ProtocolInformation, svnPredicate);
|
||||
binder.bind("repos.repository-avatar", SvnAvatar, svnPredicate);
|
||||
|
||||
// bind global configuration
|
||||
|
||||
cfgBinder.bindGlobal("/svn", "scm-svn-plugin.config.link", "svnConfig", SvnGlobalConfiguration);
|
||||
|
||||
@@ -2,6 +2,27 @@
|
||||
"scm-svn-plugin": {
|
||||
"information": {
|
||||
"checkout" : "Checkout repository"
|
||||
},
|
||||
"config": {
|
||||
"link": "Subversion",
|
||||
"title": "Subversion Configuration",
|
||||
"directory": "Repository Directory",
|
||||
"directoryHelpText": "Location of Subversion repositories.",
|
||||
"compatibility": "Version Compatibility",
|
||||
"compatibilityHelpText": "Specifies with which subversion version repositories are compatible.",
|
||||
"compatibility-values": {
|
||||
"none": "No compatibility",
|
||||
"pre14": "Pre 1.4 Compatible",
|
||||
"pre15": "Pre 1.5 Compatible",
|
||||
"pre16": "Pre 1.6 Compatible",
|
||||
"pre17": "Pre 1.7 Compatible",
|
||||
"with17": "With 1.7 Compatible"
|
||||
},
|
||||
"enabledGZip": "Enable GZip Compression",
|
||||
"enabledGZipHelpText": "Enable GZip compression for svn responses.",
|
||||
"disabled": "Disabled",
|
||||
"disabledHelpText": "Enable or disable the Git plugin",
|
||||
"required": "This configuration value is required"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ package sonia.scm.repository.spi;
|
||||
import org.junit.Test;
|
||||
import sonia.scm.repository.BrowserResult;
|
||||
import sonia.scm.repository.FileObject;
|
||||
import sonia.scm.repository.RevisionNotFoundException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
@@ -55,7 +54,7 @@ public class SvnBrowseCommandTest extends AbstractSvnCommandTestBase
|
||||
{
|
||||
|
||||
@Test
|
||||
public void testBrowseWithFilePath() throws RevisionNotFoundException {
|
||||
public void testBrowseWithFilePath() {
|
||||
BrowseCommandRequest request = new BrowseCommandRequest();
|
||||
request.setPath("a.txt");
|
||||
FileObject file = createCommand().getBrowserResult(request).getFile();
|
||||
@@ -65,7 +64,7 @@ public class SvnBrowseCommandTest extends AbstractSvnCommandTestBase
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testBrowse() throws RevisionNotFoundException {
|
||||
public void testBrowse() {
|
||||
Collection<FileObject> foList = getRootFromTip(new BrowseCommandRequest());
|
||||
|
||||
FileObject a = getFileObject(foList, "a.txt");
|
||||
@@ -89,7 +88,7 @@ public class SvnBrowseCommandTest extends AbstractSvnCommandTestBase
|
||||
* @throws IOException
|
||||
*/
|
||||
@Test
|
||||
public void testBrowseSubDirectory() throws RevisionNotFoundException {
|
||||
public void testBrowseSubDirectory() {
|
||||
BrowseCommandRequest request = new BrowseCommandRequest();
|
||||
|
||||
request.setPath("c");
|
||||
@@ -136,7 +135,7 @@ public class SvnBrowseCommandTest extends AbstractSvnCommandTestBase
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDisableLastCommit() throws RevisionNotFoundException {
|
||||
public void testDisableLastCommit() {
|
||||
BrowseCommandRequest request = new BrowseCommandRequest();
|
||||
|
||||
request.setDisableLastCommit(true);
|
||||
@@ -150,7 +149,7 @@ public class SvnBrowseCommandTest extends AbstractSvnCommandTestBase
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testRecursive() throws RevisionNotFoundException {
|
||||
public void testRecursive() {
|
||||
BrowseCommandRequest request = new BrowseCommandRequest();
|
||||
request.setRecursive(true);
|
||||
BrowserResult result = createCommand().getBrowserResult(request);
|
||||
@@ -199,7 +198,7 @@ public class SvnBrowseCommandTest extends AbstractSvnCommandTestBase
|
||||
.orElseThrow(() -> new AssertionError("file " + name + " not found"));
|
||||
}
|
||||
|
||||
private Collection<FileObject> getRootFromTip(BrowseCommandRequest request) throws RevisionNotFoundException {
|
||||
private Collection<FileObject> getRootFromTip(BrowseCommandRequest request) {
|
||||
BrowserResult result = createCommand().getBrowserResult(request);
|
||||
|
||||
assertNotNull(result);
|
||||
|
||||
@@ -32,9 +32,12 @@
|
||||
|
||||
package sonia.scm.repository.spi;
|
||||
|
||||
import org.hamcrest.BaseMatcher;
|
||||
import org.hamcrest.Description;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import sonia.scm.repository.PathNotFoundException;
|
||||
import sonia.scm.repository.RevisionNotFoundException;
|
||||
import org.junit.rules.ExpectedException;
|
||||
import sonia.scm.NotFoundException;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
@@ -46,8 +49,11 @@ import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class SvnCatCommandTest extends AbstractSvnCommandTestBase {
|
||||
|
||||
@Rule
|
||||
public final ExpectedException expectedException = ExpectedException.none();
|
||||
|
||||
@Test
|
||||
public void testCat() throws PathNotFoundException, RevisionNotFoundException {
|
||||
public void testCat() {
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
|
||||
request.setPath("a.txt");
|
||||
@@ -56,35 +62,59 @@ public class SvnCatCommandTest extends AbstractSvnCommandTestBase {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleCat() throws PathNotFoundException, RevisionNotFoundException {
|
||||
public void testSimpleCat() {
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
|
||||
request.setPath("c/d.txt");
|
||||
assertEquals("d", execute(request));
|
||||
}
|
||||
|
||||
@Test(expected = PathNotFoundException.class)
|
||||
public void testUnknownFile() throws PathNotFoundException, RevisionNotFoundException {
|
||||
@Test
|
||||
public void testUnknownFile() {
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
|
||||
request.setPath("unknown");
|
||||
request.setRevision("1");
|
||||
|
||||
execute(request);
|
||||
}
|
||||
expectedException.expect(new BaseMatcher<Object>() {
|
||||
@Override
|
||||
public void describeTo(Description description) {
|
||||
description.appendText("expected NotFoundException for path");
|
||||
}
|
||||
|
||||
@Test(expected = RevisionNotFoundException.class)
|
||||
public void testUnknownRevision() throws PathNotFoundException, RevisionNotFoundException {
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
|
||||
request.setPath("a.txt");
|
||||
request.setRevision("42");
|
||||
@Override
|
||||
public boolean matches(Object item) {
|
||||
return "Path".equals(((NotFoundException)item).getContext().get(0).getType());
|
||||
}
|
||||
});
|
||||
|
||||
execute(request);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleStream() throws IOException, PathNotFoundException, RevisionNotFoundException {
|
||||
public void testUnknownRevision() {
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
|
||||
request.setPath("a.txt");
|
||||
request.setRevision("42");
|
||||
|
||||
expectedException.expect(new BaseMatcher<Object>() {
|
||||
@Override
|
||||
public void describeTo(Description description) {
|
||||
description.appendText("expected NotFoundException for revision");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean matches(Object item) {
|
||||
return "Revision".equals(((NotFoundException)item).getContext().get(0).getType());
|
||||
}
|
||||
});
|
||||
|
||||
execute(request);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSimpleStream() throws IOException {
|
||||
CatCommandRequest request = new CatCommandRequest();
|
||||
request.setPath("a.txt");
|
||||
request.setRevision("1");
|
||||
@@ -98,7 +128,7 @@ public class SvnCatCommandTest extends AbstractSvnCommandTestBase {
|
||||
catResultStream.close();
|
||||
}
|
||||
|
||||
private String execute(CatCommandRequest request) throws PathNotFoundException, RevisionNotFoundException {
|
||||
private String execute(CatCommandRequest request) {
|
||||
String content = null;
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
|
||||
|
||||
@@ -38,7 +38,6 @@ import org.junit.Test;
|
||||
import sonia.scm.repository.Changeset;
|
||||
import sonia.scm.repository.ChangesetPagingResult;
|
||||
import sonia.scm.repository.Modifications;
|
||||
import sonia.scm.repository.RevisionNotFoundException;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@@ -57,7 +56,7 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
|
||||
{
|
||||
|
||||
@Test
|
||||
public void testGetAll() throws RevisionNotFoundException {
|
||||
public void testGetAll() {
|
||||
ChangesetPagingResult result =
|
||||
createCommand().getChangesets(new LogCommandRequest());
|
||||
|
||||
@@ -67,7 +66,7 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAllByPath() throws RevisionNotFoundException {
|
||||
public void testGetAllByPath() {
|
||||
LogCommandRequest request = new LogCommandRequest();
|
||||
|
||||
request.setPath("a.txt");
|
||||
@@ -83,7 +82,7 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAllWithLimit() throws RevisionNotFoundException {
|
||||
public void testGetAllWithLimit() {
|
||||
LogCommandRequest request = new LogCommandRequest();
|
||||
|
||||
request.setPagingLimit(2);
|
||||
@@ -106,7 +105,7 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetAllWithPaging() throws RevisionNotFoundException {
|
||||
public void testGetAllWithPaging() {
|
||||
LogCommandRequest request = new LogCommandRequest();
|
||||
|
||||
request.setPagingStart(1);
|
||||
@@ -130,7 +129,7 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetCommit() throws RevisionNotFoundException, IOException {
|
||||
public void testGetCommit() {
|
||||
Changeset c = createCommand().getChangeset("3");
|
||||
|
||||
assertNotNull(c);
|
||||
@@ -151,7 +150,7 @@ public class SvnLogCommandTest extends AbstractSvnCommandTestBase
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testGetRange() throws RevisionNotFoundException {
|
||||
public void testGetRange() {
|
||||
LogCommandRequest request = new LogCommandRequest();
|
||||
|
||||
request.setStartChangeset("2");
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user