|
1 | | -import type { Commit, Branch, GitState } from "./GitTypes"; |
| 1 | +// import type { Commit, Branch, GitState } from "./GitTypes"; |
2 | 2 |
|
3 | | -// This file will be used for actual Git operations in a real application |
4 | | -// For now, it just contains mock implementations |
| 3 | +// // This file will be used for actual Git operations in a real application |
| 4 | +// // For now, it just contains mock implementations |
5 | 5 |
|
6 | | -// Fetch branches for the current repository |
7 | | -export const fetchBranches = async (): Promise<Branch[]> => { |
8 | | - // In a real app, this would make an API call to fetch branches |
9 | | - // For demo purposes, returning mock data |
10 | | - return [ |
11 | | - { name: "main", isActive: false }, |
12 | | - { name: "versioning", isActive: true }, |
13 | | - { name: "feature/ui-updates", isActive: false }, |
14 | | - ]; |
15 | | -}; |
| 6 | +// // Fetch branches for the current repository |
| 7 | +// export const fetchBranches = async (): Promise<Branch[]> => { |
| 8 | +// // In a real app, this would make an API call to fetch branches |
| 9 | +// // For demo purposes, returning mock data |
| 10 | +// return [ |
| 11 | +// { name: "main", isActive: false }, |
| 12 | +// { name: "versioning", isActive: true }, |
| 13 | +// { name: "feature/ui-updates", isActive: false }, |
| 14 | +// ]; |
| 15 | +// }; |
16 | 16 |
|
17 | | -// Fetch commits for the specified branch |
18 | | -export const fetchCommits = async (branchName: string): Promise<Commit[]> => { |
19 | | - // In a real app, this would make an API call to fetch commits for the branch |
20 | | - // For demo purposes, returning mock data (ignoring branchName parameter for now) |
21 | | - return [ |
22 | | - { |
23 | | - id: "abc123", |
24 | | - message: "Initial commit", |
25 | | - author: "John Doe", |
26 | | - date: new Date(2023, 7, 15, 10, 30), |
27 | | - isCurrent: false, |
28 | | - }, |
29 | | - { |
30 | | - id: "def456", |
31 | | - message: "Add authentication flow", |
32 | | - author: "Jane Smith", |
33 | | - date: new Date(2023, 7, 20, 14, 45), |
34 | | - isCurrent: false, |
35 | | - }, |
36 | | - { |
37 | | - id: "ghi789", |
38 | | - message: "Fix styling issues", |
39 | | - author: "John Doe", |
40 | | - date: new Date(2023, 7, 25, 9, 15), |
41 | | - isCurrent: true, |
42 | | - }, |
43 | | - ]; |
44 | | -}; |
| 17 | +// // Fetch commits for the specified branch |
| 18 | +// export const fetchCommits = async (): Promise<Commit[]> => { |
| 19 | +// // In a real app, this would make an API call to fetch commits for the branch |
| 20 | +// // For demo purposes, returning mock data (ignoring branchName parameter for now) |
| 21 | +// return [ |
| 22 | +// { |
| 23 | +// id: "abc123", |
| 24 | +// message: "Initial commit", |
| 25 | +// author: "John Doe", |
| 26 | +// date: new Date(2023, 7, 15, 10, 30), |
| 27 | +// isCurrent: false, |
| 28 | +// }, |
| 29 | +// { |
| 30 | +// id: "def456", |
| 31 | +// message: "Add authentication flow", |
| 32 | +// author: "Jane Smith", |
| 33 | +// date: new Date(2023, 7, 20, 14, 45), |
| 34 | +// isCurrent: false, |
| 35 | +// }, |
| 36 | +// { |
| 37 | +// id: "ghi789", |
| 38 | +// message: "Fix styling issues", |
| 39 | +// author: "John Doe", |
| 40 | +// date: new Date(2023, 7, 25, 9, 15), |
| 41 | +// isCurrent: true, |
| 42 | +// }, |
| 43 | +// ]; |
| 44 | +// }; |
45 | 45 |
|
46 | | -// Switch to a different branch |
47 | | -export const switchBranch = async (branchName: string): Promise<GitState> => { |
48 | | - // In a real app, this would make an API call to switch branches |
49 | | - // For demo purposes, returning mock data |
50 | | - const branches = await fetchBranches(); |
51 | | - const updatedBranches = branches.map((branch) => ({ |
52 | | - ...branch, |
53 | | - isActive: branch.name === branchName, |
54 | | - })); |
| 46 | +// // Switch to a different branch |
| 47 | +// export const switchBranch = async (branchName: string): Promise<GitState> => { |
| 48 | +// // In a real app, this would make an API call to switch branches |
| 49 | +// // For demo purposes, returning mock data |
| 50 | +// const branches = await fetchBranches(); |
| 51 | +// const updatedBranches = branches.map((branch) => ({ |
| 52 | +// ...branch, |
| 53 | +// isActive: branch.name === branchName, |
| 54 | +// })); |
55 | 55 |
|
56 | | - const commits = await fetchCommits(branchName); |
| 56 | +// const commits = await fetchCommits(branchName); |
57 | 57 |
|
58 | | - return { |
59 | | - branches: updatedBranches, |
60 | | - commits, |
61 | | - currentBranch: branchName, |
62 | | - }; |
63 | | -}; |
| 58 | +// return { |
| 59 | +// branches: updatedBranches, |
| 60 | +// commits, |
| 61 | +// currentBranch: branchName, |
| 62 | +// }; |
| 63 | +// }; |
64 | 64 |
|
65 | | -// Create a new commit |
66 | | -export const createCommit = async (message: string): Promise<Commit> => { |
67 | | - // In a real app, this would make an API call to create a commit |
68 | | - // For demo purposes, returning mock data |
69 | | - return { |
70 | | - id: `commit_${Date.now()}`, |
71 | | - message, |
72 | | - author: "Current User", |
73 | | - date: new Date(), |
74 | | - isCurrent: true, |
75 | | - }; |
76 | | -}; |
| 65 | +// // Create a new commit |
| 66 | +// export const createCommit = async (message: string): Promise<Commit> => { |
| 67 | +// // In a real app, this would make an API call to create a commit |
| 68 | +// // For demo purposes, returning mock data |
| 69 | +// return { |
| 70 | +// id: `commit_${Date.now()}`, |
| 71 | +// message, |
| 72 | +// author: "Current User", |
| 73 | +// date: new Date(), |
| 74 | +// isCurrent: true, |
| 75 | +// }; |
| 76 | +// }; |
77 | 77 |
|
78 | | -// Rollback to a specific commit |
79 | | -export const rollbackToCommit = async (commitId: string): Promise<Commit[]> => { |
80 | | - // In a real app, this would make an API call to rollback to a commit |
81 | | - // For demo purposes, returning mock data |
82 | | - const commits = await fetchCommits("versioning"); |
83 | | - return commits.map((commit) => ({ |
84 | | - ...commit, |
85 | | - isCurrent: commit.id === commitId, |
86 | | - })); |
87 | | -}; |
| 78 | +// // Rollback to a specific commit |
| 79 | +// export const rollbackToCommit = async (commitId: string): Promise<Commit[]> => { |
| 80 | +// // In a real app, this would make an API call to rollback to a commit |
| 81 | +// // For demo purposes, returning mock data |
| 82 | +// const commits = await fetchCommits("versioning"); |
| 83 | +// return commits.map((commit) => ({ |
| 84 | +// ...commit, |
| 85 | +// isCurrent: commit.id === commitId, |
| 86 | +// })); |
| 87 | +// }; |
0 commit comments