我有一个大的git存储库,我想查找按日期排序的长时间未修改的文件列表,我尝试了命令:
git log --pretty=format: --summary --before="<date>"
它为我提供了date
之前修改过文件的文件列表,但我想知道所有文件按最后修改日期按降序排序(最旧的文件将位于顶部)。此外,列表应该只包含存储库中当前存在的文件,我不关心已经删除的文件。
有人能建议正确的命令吗?
答案 0 :(得分:3)
基于链接,在评论中发布@Fred,您可以尝试:
private Camera.PictureCallback mPicture = new Camera.PictureCallback() {
@Override
public void onPictureTaken(byte[] data, Camera camera) {
try {
m_bitmap = BitmapFactory.decodeByteArray(data, 0, data.length);
if (getScreenOrientation() == 1){
mBitmap = BitmapHelper.getRotatedBitmap(m_bitmap, 270);
}
}else if (getScreenOrientation() == 0){
mBitmap = BitmapHelper.getRotatedBitmap(m_bitmap,0);
}else if (getScreenOrientation() == 9){
mBitmap =BitmapHelper.getRotatedBitmap(m_bitmap, 90);
}else if (getScreenOrientation() == 8){
mBitmap = BitmapHelper.getRotatedBitmap(m_bitmap,180);
}
}
mImageViewPreview.setImageBitmap(mBitmap);
}
catch (Exception e) {
e.printStackTrace();
}
stopCameraPreview();
}
};
// getting screenOrientation
private int getScreenOrientation() {
int rotation = this.getWindowManager().getDefaultDisplay().getRotation();
DisplayMetrics dm = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(dm);
int width = dm.widthPixels;
int height = dm.heightPixels;
int orientation;
// if the device's natural orientation is portrait:
if ((rotation == Surface.ROTATION_0
|| rotation == Surface.ROTATION_180) && height > width ||
(rotation == Surface.ROTATION_90
|| rotation == Surface.ROTATION_270) && width > height) {
isLandScape = false;
switch(rotation) {
case Surface.ROTATION_0:
orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
break;
case Surface.ROTATION_90:
orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
break;
case Surface.ROTATION_180:
orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
break;
case Surface.ROTATION_270:
orientation = ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
break;
default:
Log.e("", "Unknown screen orientation. Defaulting to " + "portrait.");
orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
break;
}
}
// if the device's natural orientation is landscape or if the device
// is square:
else {
isLandScape = true;
switch(rotation) {
case Surface.ROTATION_0:
orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
break;
case Surface.ROTATION_90:
orientation = ActivityInfo.SCREEN_ORIENTATION_PORTRAIT;
break;
case Surface.ROTATION_180:
orientation =
ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE;
break;
case Surface.ROTATION_270:
orientation =
ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT;
break;
default:
Log.e("", "Unknown screen orientation. Defaulting to " +
"landscape.");
orientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE;
break;
}
}
return orientation;
}
这对我有用。
答案 1 :(得分:1)
不要认为有git
命令可以执行此操作,但请尝试tree
命令和sort
。
它看起来有点难看,但我相信它非常接近你想要的东西
tree -ifFCD --timefmt '%Y%m%d %H%M%S' | sort -k1 -k2
-D
打印上次修改时间的日期,或者如果使用-c
, 列出文件的最后状态更改时间。